Re: [go-nuts] Bets approach for test helper packages within same project

2023-08-04 Thread Nagaev Boris
Hi, You can put test helpers to a separate package (directory), say testhelper/ without a build tag. Code in that directory will use regular code and it will have its own unit tests in testhelper/ directory. When you build your production binary, it won't include such code, because it is not

Re: [go-nuts] Clarification on code snippet

2023-08-04 Thread alchemist vk
Thank you Axel and burak for clarification. Now I am able to understand the syntax. Thank you again. With regards, Venkatesh On Fri, Aug 4, 2023 at 10:28 PM Axel Wagner wrote: > Another relevant section is Calls (emphasis > mine): > >> A method call x.m() is

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
On Fri, Aug 4, 2023, 13:57 Harri L wrote: > Yes, we can handle Go errors without language changes; that’s true. But > how we should annotate errors? The presented version of CopyFile leads to > following 'stuttering': > cannot copy '/tmpfs/play' to './tmp33/not-exist.txt': cannot create >

Re: [go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread jimmy frasche
I wish there were more cases where the types could be elided. Always leaving it off would be a bad idea but how much to put in should be at the author's discretion. There are times when it clarifies but more times when it just adds extra steps. I know that the current rules have justifications but

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Harri L
Yes, we can handle Go errors without language changes; that’s true. But how we should annotate errors? The presented version of CopyFile leads to following 'stuttering': cannot copy '/tmpfs/play' to './tmp33/not-exist.txt': cannot create destination: open ./tmp33/not-exist.txt: no such file

Re: [go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread Ian Lance Taylor
On Fri, Aug 4, 2023 at 8:08 AM Nate Finch wrote: > > If I have a struct > > type User struct { > Name string > ID int > } > > type Group struct { > Leader User > } > > Why is it that the go tool can't infer what type I'm constructing for the > Leader field here? > > g := Group{ >

Re: [go-nuts] Clarification on code snippet

2023-08-04 Thread 'Axel Wagner' via golang-nuts
Another relevant section is Calls (emphasis mine): > A method call x.m() is valid if the method set of (the type of) x contains > m and the argument list can be assigned to the parameter list of m. *If x > is addressable and 's method set contains m, x.m() is

Re: [go-nuts] Re: Error handling

2023-08-04 Thread DrGo
Thanks Miguel and I am not offended.. It sounds you like the proposal and your comments were not about the proposal per se but about the cultural issues surrounding change and fear of unnecessary growth; here we agree too. On Friday, August 4, 2023 at 6:47:37 AM UTC-6 Miguel Angel Rivera

Re: [go-nuts] Clarification on code snippet

2023-08-04 Thread burak serdar
On Fri, Aug 4, 2023 at 10:33 AM alchemist vk wrote: > Hi folks, > In below code, I am invoking receiver api show() via a simple uInteger > type variable instead of pointer, by which it expects to be invoked . Go > being strict with type casing and I was expecting a compiler error. But to > my

[go-nuts] glog symbolic link flag is not used

2023-08-04 Thread Martins Ungurs
Hello! glog's flag "log_link" is defined, but not used. Symbolic links are created without using this flag. https://github.com/golang/glog/blob/master/glog_file.go#L46 Thanks, Martin. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Clarification on code snippet

2023-08-04 Thread alchemist vk
Hi folks, In below code, I am invoking receiver api show() via a simple uInteger type variable instead of pointer, by which it expects to be invoked . Go being strict with type casing and I was expecting a compiler error. But to my surprise, it compiled and executed successfully. Can you folks

[go-nuts] Resident set not decreasing after load decreased

2023-08-04 Thread Dilshan Sandhu
Hi, I am working on a chat application build with golang. I am using open-source server tinode (https://github.com/tinode/chat) as base for my chat application. Issue is I am facing is the Resident set (as shown by top) shows very high memory usage after a load test ends. Also increasing

[go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread Nate Finch
If I have a struct type User struct { Name string ID int } type Group struct { Leader User } Why is it that the go tool can't infer what type I'm constructing for the Leader field here? g := Group{ Leader: { Name: "Jamie", ID: 5, }, } Cleary, the

Re: [go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Jan Mercl
On Fri, Aug 4, 2023 at 1:22 PM Brian Candler wrote: > Also there's a project which compiles C code to Go - ISTR it was used to > build a pure Go version of Sqlite. Presumably the same approach could be > applied to an image processing library. > >

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Victor Giordano
Ok, that is a point to have in mind. El vie, 4 ago 2023 a las 10:37, Miguel Angel Rivera Notararigo (< ntr...@gmail.com>) escribió: > I understand, but there is a little difference, you can find code out > there improving performance thanks to generics, I am not sure if we can get > any

[go-nuts] Bets approach for test helper packages within same project

2023-08-04 Thread josvazg
We are working on a project that requires some test helpers and mocks that, ideally, should: - Helpers should be accessible by all testing code, unit tests, integration or e2e. - Note unit tests live along side normal code in their *_test.go files. - The rest of tests will be on a

[go-nuts] slog's use of runtime.Callers() with a skip

2023-08-04 Thread 'sh...@tigera.io' via golang-nuts
I was looking at replacing logrus with the new slog library in our project. I noticed that it uses runtime.Callers() with a fixed skip to collect the PC of the calling code, presumably to make it possible for the handler

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
I understand, but there is a little difference, you can find code out there improving performance thanks to generics, I am not sure if we can get any performance improvement by using "orelse return err". > -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Victor Giordano
> Generics add a lot of value >From a personal point of view with the interfaces I got all the genericity I needed to model solutions, and generics per se doesn't provide a new approach to find solutions. I Mean, you can solve the same old problems with or without generics... Generics provides

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
It is not just resistance to change, it is about not adding new features that add more complexity than value. I am pretty sure people will complain about Go's error handling even if we use "orelse return err". Generics add a lot of value, it shows the Go team is open to changes. But imagine they

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Victor Giordano
As far as I see things there is always room for changes... but changes doesn't come without some resistance.. That is natural... > Go best features is the lack of new features. What about generics? That was a major change... It was really necessary or not is another topic. El vie, 4 ago 2023 a

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
On Thu, Aug 3, 2023, 23:45 DrGo wrote: > @Miguel Angel Rivera Notararigo > > Thanks for taking the time to write... > > In my proposal, people are free to add as much context as they want... > Yeah I know, I like your proposal, it is just how they handle errors in the V programming language,

[go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Brian Candler
Also there's a project which compiles C code to Go - ISTR it was used to build a pure Go version of Sqlite. Presumably the same approach could be applied to an image processing library. https://twitter.com/bradfitz/status/855271867162083329?lang=en

[go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Mandolyte
and https://pkg.go.dev/github.com/canhlinh/svg2png On Friday, August 4, 2023 at 4:48:26 AM UTC-4 Mark wrote: > Thanks! > > On Friday, August 4, 2023 at 8:46:18 AM UTC+1 Tamás Gulácsi wrote: > >> https://pkg.go.dev/github.com/goki/gi/svg >> >> Mark a következőt írta (2023. augusztus 3.,

[go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread 'Mark' via golang-nuts
Thanks! On Friday, August 4, 2023 at 8:46:18 AM UTC+1 Tamás Gulácsi wrote: > https://pkg.go.dev/github.com/goki/gi/svg > > Mark a következőt írta (2023. augusztus 3., csütörtök, 13:18:48 UTC+2): > >> I know this has been asked before, just wondered if there were any >> pure-Go solutions? >> >

Re: [go-nuts] Realpath?

2023-08-04 Thread TheDiveO
Also, your function (as well as the one you seem to have copied and modified, did I get that right from your documentation?) will most probably not work correctly if there are symlinks "inside" the path and not just at the beginning of the given path. There's a reason to my limited

Re: [go-nuts] Realpath?

2023-08-04 Thread TheDiveO
As I couldn't figure this out from the repo's documentation: what's the difference and what's the benefit compared to stdlib https://pkg.go.dev/path/filepath#EvalSymlinks? On Thursday, August 3, 2023 at 8:57:08 PM UTC+2 Carlos Henrique Guardão Gandarez wrote: > Hey there! > > I created a new

[go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Tamás Gulácsi
https://pkg.go.dev/github.com/goki/gi/svg Mark a következőt írta (2023. augusztus 3., csütörtök, 13:18:48 UTC+2): > I know this has been asked before, just wondered if there were any pure-Go > solutions? > -- You received this message because you are subscribed to the Google Groups