Re: [go-nuts] initialization loop ?

2021-10-25 Thread Ian Lance Taylor
On Sat, Oct 23, 2021 at 9:05 AM Michael Ellis wrote: > > > The rules for when an initialization loop occurs are part of the language > > spec: https://golang.org/ref/spec#Package_initialization. > > Thanks for the link. It helps with questions I've had recently about package > initialization.

[go-nuts] How to negotiate authentication over HTTP ? (the Go way)

2021-10-25 Thread mi...@ubo.ro
I find myself in need to handle various authentication schemes such "proprietary" oauth2 schemes and NTLM. The easy and clean way to do it (API wise) would be using a http.RoundTripper but looks like it forbids you from even reading the response headers. In the end I just made a ``func

Re: [go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread Rob Pike
See also https://github.com/golang/go/issues/29982. It gets more interesting towards the bottom, but the proposal is on hold. Be nice to release it again though. I do favor it. -rob On Tue, Oct 26, 2021 at 8:48 AM Ian Lance Taylor wrote: > > On Sun, Oct 24, 2021 at 4:45 PM jlfo...@berkeley.edu

Re: [go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread Ian Lance Taylor
On Sun, Oct 24, 2021 at 4:45 PM jlfo...@berkeley.edu wrote: > > But, I still have some questions about the responses. First, I think the > expected value of len(struct) should be its size, in bytes, > like with a string. Are there any examples of problems this would cause? I believe that that

[go-nuts] New Releases: Command Line Interface Generator tool for Go

2021-10-25 Thread John Brown
Just released Gofire, a tool for Go that automatically generates a command line interface (CLI) for your functions and does all required plumbing in between, inspired by *https://github.com/google/python-fire.* *https://github.com/1pkg/gofire* - Gofire uses code generation to generate

Re: [go-nuts] Does GC pause affect non-go threads spawned by CGo?

2021-10-25 Thread Robert Engels
No, unless they call back into Go. > On Oct 25, 2021, at 10:43 AM, Amir DER wrote: > > Does GC pause affect non-go threads spawned by CGo? > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop

[go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread jake...@gmail.com
On Sunday, October 24, 2021 at 7:44:40 PM UTC-4 jlfo...@berkeley.edu wrote: > Thanks for the replies. > > I had been trying to translate the trick from C into Go where you can find > how many structures are in an initialized array of structures > by dividing the size of the array by the size of

Re: [go-nuts] Why Doesn't "len()" Work With Structs?

2021-10-25 Thread 'burak serdar' via golang-nuts
On Sun, Oct 24, 2021 at 12:12 PM jlfo...@berkeley.edu < jlforr...@berkeley.edu> wrote: > I noticed that the len() function doesn't take a struct as an argument > (see below). > This is a big surprise. Can someone shed some light on why this > restriction exists? > len() gives the number of

Re: [go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread 'burak serdar' via golang-nuts
On Sun, Oct 24, 2021 at 6:54 PM jlfo...@berkeley.edu wrote: > I'm now aware that that I could use > > len(([unsafe.Sizeof(T{})][0]byte{})) > > But this seems overly complicated. Plus, I don't see why > this is unsafe. Please advise. > Sizeof is unsafe because it returns the number of bytes of

[go-nuts] Does GC pause affect non-go threads spawned by CGo?

2021-10-25 Thread Amir DER
Does GC pause affect non-go threads spawned by CGo? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this