Re: [go-nuts] How to cast a multi-value?

2021-05-16 Thread Kurtis Rader
On Sun, May 16, 2021 at 7:49 PM 'Marc Michael' via golang-nuts < golang-nuts@googlegroups.com> wrote: > as Go provides multi values I would expect that's possible to cast such a > multi value. Do I see it correctly, that Go does not provide it? > > Example: > > os.ReadFile returns []byte, error. >

[go-nuts] How to cast a multi-value?

2021-05-16 Thread 'Marc Michael' via golang-nuts
Hello, as Go provides multi values I would expect that's possible to cast such a multi value. Do I see it correctly, that Go does not provide it? Example: os.ReadFile returns []byte, error. I want to cast the []byte to a string. content, err := os.ReadFile(path) Is it possible to cast the []by

Re: [go-nuts] Go compiler - syntax tree vs AST?

2021-05-16 Thread liu si
> As far as I know the most likely next evolutionary step in this area will be to replace the Node tree with the cmd/compile/internal/syntax tree. hello All, I have a question. As far as I know, the AST transformation phase has been in existence for several years now. So I want to know the rea

Re: [go-nuts] Re: Generics and parentheses

2021-05-16 Thread 肖坤超
You can use ... As a generic Chinese 你可以使用 ... 作为泛型标志 在2020年8月26日星期三 UTC+8 上午4:59:41 写道: > Thanks for the note. Please see the discussion at > https://groups.google.com/d/msg/golang-nuts/iAD0NBz3DYw/VcXSK55XAwAJ . > > Ian > > On Tue, Aug 25, 2020 at 1:21 PM Kaveh Shahbazian > wrote: > > > >

[go-nuts] Re: go.mod necessary for GitHub package?

2021-05-16 Thread Manlio Perillo
Sorry, I used an incorrect example. The final user is supposed to be in module mode and even if in GOPATH mode, the latest version is still compatible with the old version. On Sunday, May 16, 2021 at 4:04:38 PM UTC+2 Manlio Perillo wrote: > One example (not tested) is the case of a module X th

[go-nuts] Re: go.mod necessary for GitHub package?

2021-05-16 Thread Manlio Perillo
One example (not tested) is the case of a module X that depends on A and B. A depends on an old version of github.com/speedata/hyphenation, and B depends on a new version (that is compatible with the old version but has a new API). In GOPATH mode, X can not be built. Manlio On Sunday, May 16,

[go-nuts] Re: go.mod necessary for GitHub package?

2021-05-16 Thread Patrick
OK, but what are the advantages for others? For my projects I use modules (locally) to have a list of dependencies with a checksum so builds could be reproducible. This works for remote packages with and without go.mod. What is the actual value for other users? Is this about versioning (semanti

[go-nuts] Re: go.mod necessary for GitHub package?

2021-05-16 Thread Manlio Perillo
The advantage of adding a go.mod file is not for you, but for people that will add your package as a dependency. Manlio On Sunday, May 16, 2021 at 8:25:23 AM UTC+2 Patrick wrote: > Hello all, > > I have a small package without any dependencies (besides standard library) > on GitHub. Just a si

[go-nuts] Re: Strange benchmark results

2021-05-16 Thread tapi...@gmail.com
On Sunday, May 16, 2021 at 4:46:44 AM UTC-4 Brian Candler wrote: > On Sunday, 16 May 2021 at 08:07:17 UTC+1 tapi...@gmail.com wrote: > >> > you don't provide memory allocation statistics, >> >> There are no surprises in memory allocation statistics so I didn't >> mention them. >> >> > I think i

[go-nuts] Re: Strange benchmark results

2021-05-16 Thread Brian Candler
On Sunday, 16 May 2021 at 08:07:17 UTC+1 tapi...@gmail.com wrote: > > you don't provide memory allocation statistics, > > There are no surprises in memory allocation statistics so I didn't mention > them. > > I think it is relevant, because your different functions return slices of different cap

[go-nuts] Re: Strange benchmark results

2021-05-16 Thread tapi...@gmail.com
> you don't provide the Go version, My Go version is Go 1.16.3. (BTW, "go test" really should print Go version in the first line). > you don't provide memory allocation statistics, There are no surprises in memory allocation statistics so I didn't mention them. > you only provide results for