[go-nuts] Re: Equivalent Interfaces - why does this fail to compile?

2021-05-24 Thread Amnon
yes, but surely the return types are equivalent? On Monday, 24 May 2021 at 17:08:07 UTC+1 asv...@gmail.com wrote: > > Interfaces are not equal: "m2() aer" and "m2() ber" has different return > type. Even compiler told you about it. > On Monday, May 24, 2021 at 9:20:51 AM UTC+3 Amnon wrote: > >>

Re: [go-nuts] Re: Equivalent Interfaces - why does this fail to compile?

2021-05-24 Thread 'Axel Wagner' via golang-nuts
No, they are not. They are both defined types and as such, are not identical . To repeat, this is answered in the FAQ . On Mon, May 24, 2021 at 11:06 PM Amnon wrote: > yes, but surely the return types are

[go-nuts] Re: Go's compatiblity with non-module repositories

2021-05-24 Thread 'Bryan C. Mills' via golang-nuts
The go get command ensures that all packages transitively imported by the named package(s) are provided by some module in the module dependency graph. The go mod tidy subcommand does the same for all packages

[go-nuts] Re: How to a JSON is contain in an array JSON objects in golang

2021-05-24 Thread Neal McConachie
The first recommendation I have is to make yourself a set of tests. In terms of this specific problem, it is likely because you're comparing pointers. Here is an alternate approach that doesn't use reflection, and deals with the pointers as well: https://play.golang.org/p/9o7yGioRWYl I'd

[go-nuts] Equivalent Interfaces - why does this fail to compile?

2021-05-24 Thread Amnon
See https://play.golang.org/p/5x9JrD55WKc The interfaces aer and ber look equivalent. Both contain a function which returns nothing called m1 and a function which returns another an instance of the interface m2. If we comment out m2, then the code will compile. But otherwise we get an error:

Re: [go-nuts] Equivalent Interfaces - why does this fail to compile?

2021-05-24 Thread 'Axel Wagner' via golang-nuts
This is answered in the FAQ: https://golang.org/doc/faq#covariant_types On Mon, May 24, 2021 at 8:21 AM Amnon wrote: > See https://play.golang.org/p/5x9JrD55WKc > > The interfaces aer and ber look equivalent. > Both contain a function which returns nothing called m1 > and a function which

[go-nuts] Re: Strange benchmark results

2021-05-24 Thread tapi...@gmail.com
After some profiling investigations, it looks the following code has not been optimized yet: s2 := make([]int, len(s) + len(vs)) copy(s2, s[:k]) copy(s2[k:], vs) copy(s2[k+len(vs):], s[k:]) Much unnecessary time is consumed on memclrNoHeapPointers. The one-line implementation

[go-nuts] Re: Strange benchmark results

2021-05-24 Thread tapi...@gmail.com
The profiling results constantly show that more time are spent on memclrNoHeapPointers if N is a big even integer (1615118) than a big odd integer (1615119). On Thursday, May 13, 2021 at 5:07:49 AM UTC-4 tapi...@gmail.com wrote: > Sorry, there is a temp tweak, the N/5 should be N/2. > The

Re: [go-nuts] Re: Is the escape analysis reports accurate?

2021-05-24 Thread tapi...@gmail.com
I will if I get enough time and become more familiar with the code. Meanwhile, I think it is a not a bad idea to post my investigations here. If some people with relevant experiences could make some explanations without spending their much time, that is the best. I thank them for clearing my

Re: [go-nuts] How to restore ignored signals

2021-05-24 Thread Manlio Perillo
On Sunday, May 23, 2021 at 12:29:47 AM UTC+2 Ian Lance Taylor wrote: > On Sat, May 22, 2021 at 5:53 AM Manlio Perillo > wrote: > > > > I'm curious to know if sigprocmask is safe/convenient to use in a Go > program. > > It's possible, of course, but it's not particularly convenient. >

[go-nuts] How to a JSON is contain in an array JSON objects in golang

2021-05-24 Thread Van Fury
Hi, I have an array of JSON objects as Structs: ``` type Data struct { TaiList []Tai `json:"taiList"` } type Tai struct { PlmnId *PlmnId `json:"plmnId"` Tac string `json:"tac"` Nid string `json:"nid"` } type PlmnId struct { Mcc string `json:"mcc"` Mnc string

[go-nuts] Re: Equivalent Interfaces - why does this fail to compile?

2021-05-24 Thread Alexander Verbitsky
Interfaces are not equal: "m2() aer" and "m2() ber" has different return type. Even compiler told you about it. On Monday, May 24, 2021 at 9:20:51 AM UTC+3 Amnon wrote: > See https://play.golang.org/p/5x9JrD55WKc > > The interfaces aer and ber look equivalent. > Both contain a function which