[go-nuts] Re: A modest format suggestion

2020-04-27 Thread Leszek Kubik
It wasn't mentioned here but I really like how C# IDE helps understanding function arguments. It's entirely true that arguments should have meaningful names but sometimes it's impossible. Standard C# function comments let you document arguments. The argument comment appears right when you need

Re: [go-nuts] Timer.Reset() (again...)

2020-04-04 Thread Leszek Kubik
I have nothing to comment about timer.Reset() but your pseudo code made me wonder if there's an interval timer available in the library, and of course it is. In the example you aim to do some work periodically, until another type of work succeeds. That's not a plain meaning of a timeout. In add

[go-nuts] Re: files stored in /home/$USER/.cache/go-build/

2020-03-29 Thread Leszek Kubik
https://golang.org/cmd/go/#hdr-Remove_object_files_and_cached_files I wouldn't remove just some of them, that sounds like a bad idea in general. Remove all if you need to. On Monday, March 30, 2020 at 6:34:17 AM UTC+2, lgo...@gmail.com wrote: > > What does Go use these files used for ? I've got

[go-nuts] Re: Unmarshalling ordered nested dynamic xml

2020-03-29 Thread Leszek Kubik
I think that interface{} type would be useful in such case var xml []interface{} You can make convenience accessor functions like func Names() []Names {} On Sunday, March 29, 2020 at 9:33:49 PM UTC+2, DrGo wrote: > > Hi, > wondering how to unmarshall the xml below (also available here > http

Re: [go-nuts] Re: Slice reuse + GC

2020-03-27 Thread Leszek Kubik
Wait, by saying it would be nice to have the GC not trace elements between len and cap, you mean it would be nice to have GC recognize unreferenced elements of a slice between len and cap and free them (presumably if they are pointer or interface types)? OK, I would say Go has quirks but I'm th

Re: [go-nuts] Re: Slice reuse + GC

2020-03-26 Thread Leszek Kubik
> I disagree. I do that all the time. It's also how `append` was implemented > before it existed as a predeclared function. It's also, FWIW, used in > bytes.Buffer . I agree that > unless your API is very clear about it, you shouldn't really access

Re: [go-nuts] Slice reuse + GC

2020-03-26 Thread Leszek Kubik
t of "freeing" the elements in-between. Anyway, I assume slices are meant to be an abstract pointers to arrays and thus they should only change the visibility not the array On Thursday, March 26, 2020 at 7:19:16 PM UTC+1, Leszek Kubik wrote: > > I let you consider an example: &g

Re: [go-nuts] Slice reuse + GC

2020-03-26 Thread Leszek Kubik
I let you consider an example: s := make([]*T, 100) s1, s2, s3 := s[:50], s[50:], s[:] ( x lines of code) s1 = s1[:5] Would you like the GC to free the elements past the last s1 slice len? What if s2, s3 are still used somewhere... On Thursday, March 26, 2020 at 7:01:34 PM UTC+1, robfig wr

[go-nuts] Re: Slice reuse + GC

2020-03-26 Thread Leszek Kubik
AFAIK it is allowed to re-slice past the len but it's rather not the way slices should be ever used. The word slice implies taking a portion from a bigger thing and that's always safe. When you append to the slice however, there's no new allocation if the underlying buffer still has place past t

[go-nuts] Re: Crud Example

2020-03-22 Thread Leszek Kubik
If you can see response from tomcat server in your browser then certainly your go example can't bind to that port, try other port. Secondly when you put the address in the browser bar you are going to execute http GET. Finally, in your example the template is only prepared but not applied in re

Re: [go-nuts] go test -race hanging with Go1.14, only with -a flag

2020-03-10 Thread Leszek Kubik
I don’t know the -a flag and go help testflags doesn’t mention it. I guess you turned off something in your tests LK On Tue, 10 Mar 2020 at 11:24, Dan Kortschak wrote: > I have a package that is dependent on bazil.org/fuse for testing via a > sysfs simulation package github.com/ev3go/sisyphus.

[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-08 Thread leszek . kubik
Hello, It would be much clearer if you posted a complete sample of a Go code. Which framework are you using for the server? I guess it could be something with the server config, can it accept POST methods? Did you test the server first, independently of your frontend, by using curl or PostMan?