Re: [go-nuts] Whats wrong with my builder pattern

2021-12-05 Thread Tyler Compton
It's because your method receivers are values, not pointers: func (b Builder) setFirst() { b.firstElement = "First element" } In Go, method receivers work a lot like regular function arguments. When you call the above method, you're operating on a copy of the Builder struct. Any time you pass

Re: [go-nuts] Whats wrong with my builder pattern

2021-12-05 Thread Reto
Hi, https://go.dev/doc/faq#methods_on_values_or_pointers >First, and most important, does the method need to modify the receiver? If it >does, the receiver must be a pointer. (Slices and maps act as references, so >their story is a little more subtle, but for instance to change the length of >

[go-nuts] Whats wrong with my builder pattern

2021-12-05 Thread Денис Мухортов
I have 2 empty strings in the output. But why? https://play.golang.com/p/v7zEVBM17YH -- 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...@googl

[go-nuts] Re: Advise about using go mod retract to fix pre go mod v2.0.0 tag

2021-12-05 Thread Zik Aeroh
Unless I'm mistaken, you should be retracting "v2.0.0+incompatible", as that's the actual version known to the Go tool. Retracting "v2.0.0" would be valid if you were retracting in the "github.com/gomodule/redigo/v2" module, which it sounds like you aren't. You wouldn't want to publish v2.0.1 t

[go-nuts] Golang: http2 client immediately close connections via proxy while idleConn was enabled

2021-12-05 Thread zzk code
I'm using Go to implement an http client and squid as a forward proxy to send requests to remote servers. Things goes well when using http/1.1 via proxy or http/1.1, http2 without proxy, however, while using http2 client via proxy, most of the connections were closed immediately and only one o

Re: [go-nuts] src/errors/errors_test.go if err != err ?

2021-12-05 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-12-05 at 13:24 -0800, arthurwil...@gmail.com wrote: > How is it possible for this test case to ever fail? > > // Same allocation should be equal to itself (not crash). > err := errors.New("jkl") > if err != err { > t.Errorf(`err != err`) > } > https://cs.opensou

[go-nuts] src/errors/errors_test.go if err != err ?

2021-12-05 Thread arthurwil...@gmail.com
How is it possible for this test case to ever fail? // Same allocation should be equal to itself (not crash). err := errors.New("jkl") if err != err { t.Errorf(`err != err`) } https://cs.opensource.google/go/go/+/master:src/errors/errors_test.go;drc=519474451a44b861e54466998a893a173bd54c4b;l=24

[go-nuts] Re: Do you have a minimal runnable go code that contain all key words in go?

2021-12-05 Thread ben...@gmail.com
Not strictly "minimal" -- it uses some keywords twice, and I'm sure it's longer than it needs to be, but here you go: https://go.dev/play/p/XPoqfI8RmyH On Monday, December 6, 2021 at 4:54:04 AM UTC+13 cuiw...@gmail.com wrote: > show me you code -- You received this message because you are sub

[go-nuts] Do you have a minimal runnable go code that contain all key words in go?

2021-12-05 Thread xie cui
show me you code -- 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 discussion on the web visit https://group

[go-nuts] Go Devroom FOSDEM 2022

2021-12-05 Thread Maartje Eyskens
Hi gophers! As every year since 2014 we're planning a Go Devroom at FOSDEM. This year FOSDEM 2022 will be held online on February 5th 202. This year we're looking for speakers who want to deliver a live or per-recorded talk as well as many volunteers to help us run the conference. If you'd lik