Re: [go-nuts] detecting cyclic references

2020-11-09 Thread 'Axel Wagner' via golang-nuts
If the slice is empty, it doesn't reference anything. If it is not empty, &x[0] can be used to identify the slice (potentially also using len/cap, if it's interesting). On Tue, Nov 10, 2020 at 4:11 AM arpad ryszka wrote: > Hi, > > is there a way to detect the cyclic reference in the following ex

Re: [go-nuts] Code duplication in similar structs

2020-11-09 Thread Robert Engels
If the logic is the same, wrap the field in an accessor method and use an interface. > On Nov 9, 2020, at 9:11 PM, Brandon Busby > wrote: > > I have structs with duplicate fields and duplicate code to go along with > them. The problem is that the duplicate code does make use of non-common

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread Denis Telyukh
Thanks! Maybe it will help. вт, 10 нояб. 2020 г. в 01:21, seank...@gmail.com : > maybe setting GODEBUG=http2debug=2 to spit out some logs? > > On Monday, November 9, 2020 at 5:49:57 PM UTC+1 telyuk...@gmail.com wrote: > >> Hello! >> >> I use third-party software with my own code to build reverse-

[go-nuts] Hiring Go Engineers at Omaze

2020-11-09 Thread Pablo Perez
We are looking for Go Engineers and willing to train up Java, C# or other enterprise developers. We were named by Fast Company as one of the top 50 most innovative companies. For more information post here or feel free to reach out to me directly at pablo.pe...@omaze.com https://boards.greenh

Re: [go-nuts] Code duplication in similar structs

2020-11-09 Thread Brandon Busby
I have structs with duplicate fields and duplicate code to go along with them. The problem is that the duplicate code does make use of non-common fields. Here is an example of the code. https://play.golang.org/p/IkoNJTdoVLD I could extract the duplicate code sections into a method, eliminatin

[go-nuts] detecting cyclic references

2020-11-09 Thread arpad ryszka
Hi, is there a way to detect the cyclic reference in the following example somehow? Either via reflection or by other means? My understanding is that slices cannot be compared with == (unless to nil), or used as keys in maps. Is there a different way? l := []interface{}{"foo"} l[0] = l fmt.Pri

Re: [go-nuts] strconv.ParseFloat panic

2020-11-09 Thread blade...@gmail.com
thanks all, i find a race problem, and fix it. 在2020年11月7日星期六 UTC+8 上午5:28:51 写道: > OK, so you're not using Cgo, that leaves some other unsafe use, a data > race or unlikely some weird compiler bug. > > I'd start looking in api.handleDPriceRange to see where the string > input to strconv.ParseFl

[go-nuts] [security] Go 1.15.5 and Go 1.14.12 pre-announcement

2020-11-09 Thread Katie Hockman
Hello gophers, We plan to issue Go 1.15.5 and Go 1.14.12 on Thursday, November 12. These are minor releases that include security fixes. Following our policy at https://golang.org/security, this is the pre-announcement of those releases. Cheers, Katie on behalf of the Go team -- You re

Re: [go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-09 Thread Jeremy French
Hm, yep. Very similar. Interestingly, the only cohesive objections I can see in those threads are to the minor details that are different from what I'm saying. Still, though - at least the idea has been presented before. Jeremy French 607-444-1725 On Mon, Nov 9, 2020, 2:57 PM Ian Lance Taylor wr

Re: [go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-09 Thread Ian Lance Taylor
On Mon, Nov 9, 2020 at 11:20 AM Jeremy French wrote: > > First, the caveat. I know error handling is a long-standing discussion. I > know there has been lots of debate on error handling, and it can seem like > there are no more new ideas to be had on the topic. And I have looked at > several

Re: [go-nuts] gccgo problem compiling go from source

2020-11-09 Thread Gerrit Binnenmars
Hello, Hugo thanks for sharing your repo, I cloned the repo. Set the environment variables GOOS and GOARCH and called mkall.sh in the unix directory. The result is a generate:linux docker image and an _obj/_cgo_.o file in the unix directory next to a number of go files. So far this is as expecte

[go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-09 Thread Jeremy French
First, the caveat. I know error handling is a long-standing discussion. I know there has been lots of debate on error handling, and it can seem like there are no more new ideas to be had on the topic. And I have looked at several/most of the most popular proposals, and there are quite a few t

[go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread seank...@gmail.com
maybe setting GODEBUG=http2debug=2 to spit out some logs? On Monday, November 9, 2020 at 5:49:57 PM UTC+1 telyuk...@gmail.com wrote: > Hello! > > I use third-party software with my own code to build reverse-proxy, which > supports http/2. Sometimes requests hang up with infinite waiting. With >

Re: [go-nuts] go list "go:generate" files

2020-11-09 Thread Tyler Compton
I know that you're asking about how to do this with the standard tools, but you can do this with grep if you're on a platform that has the command available: grep --recursive --files-with-matches "//go:generate" or, for short: grep -rl "//go:generate" This command will output a list of files wi

[go-nuts] My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread Denis Telyukh
Hello! I use third-party software with my own code to build reverse-proxy, which supports http/2. Sometimes requests hang up with infinite waiting. With Delve I found, that it happens in https://golang.org/src/net/http/h2_bundle.go in writeHeaders or in writeDataFromHandler. But I have no any

[go-nuts] go list "go:generate" files

2020-11-09 Thread gta
Hello, is there a way to list all the files that have a `//go:generate` directive with the standard tools? I see that `go list` can show the ignored files so I am assuming it is detecting `// +build ignore` directives, but I found nothing to lit the go generate target files. Thanks in advance