Is there a preview Golang version I can download to try out generics ?

235 views
Skip to first unread message

Serge Hulne

unread,
Aug 22, 2021, 1:49:48 PM8/22/21
to golang-nuts
Is there a preview Golang version I can download to try out generics ? 

I have written a library, which I believe would benefit from generics. 

Jan Mercl

unread,
Aug 22, 2021, 1:58:50 PM8/22/21
to Serge Hulne, golang-nuts
On Sun, Aug 22, 2021 at 7:50 PM Serge Hulne <serge...@gmail.com> wrote:

> Is there a preview Golang version I can download to try out generics ?

Use this doc: https://golang.org/doc/install/source

And follow this optional step: https://golang.org/doc/install/source#head

Not tested.

Lennart Espe

unread,
Aug 22, 2021, 3:27:07 PM8/22/21
to golang-nuts
You can run Go 1.17 and use a special compile-time flag. Just use `go build -gcflags=-G=3` and you're good to go.

gotip should have generics enabled by default as well.

Ian Lance Taylor

unread,
Aug 22, 2021, 3:29:35 PM8/22/21
to Lennart Espe, golang-nuts
On Sun, Aug 22, 2021 at 12:27 PM Lennart Espe <lennar...@gmail.com> wrote:
>
> You can run Go 1.17 and use a special compile-time flag. Just use `go build -gcflags=-G=3` and you're good to go.
>
> gotip should have generics enabled by default as well.

Actually please do not try to use the -G=3 support in the Go 1.17
release. That has many known problems and nobody is working on them.
In particular please do not report bugs against the generics support
in 1.17.

Please instead try tip. That also has known problems but people are
working on them and high quality bug reports are useful.

Thanks.

Ian


> On Sunday, 22 August 2021 at 19:49:48 UTC+2 Serge Hulne wrote:
>>
>> Is there a preview Golang version I can download to try out generics ?
>>
>> I have written a library, which I believe would benefit from generics.
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7f884806-8408-444d-9337-6fe98beb60f0n%40googlegroups.com.

Serge Hulne

unread,
Aug 22, 2021, 4:45:41 PM8/22/21
to golang-nuts
All right.

Thank you!

Serge Hulne

unread,
Aug 22, 2021, 5:59:09 PM8/22/21
to golang-nuts
Do you know which values of GOOS / GOARCH I should use for a Mac with an M1 ("apple silicon") chip, is it darwin / amd64 ?

Serge.
 
On Sunday, 22 August 2021 at 21:29:35 UTC+2 Ian Lance Taylor wrote:

Ian Lance Taylor

unread,
Aug 22, 2021, 6:07:44 PM8/22/21
to Serge Hulne, golang-nuts
On Sun, Aug 22, 2021 at 2:59 PM Serge Hulne <serge...@gmail.com> wrote:
>
> Do you know which values of GOOS / GOARCH I should use for a Mac with an M1 ("apple silicon") chip, is it darwin / amd64 ?

darwin/arm64

(But in the normal case you shouldn't have to set GOOS/GOARCH
yourself, the build process should pick the right ones.)

Ian


> On Sunday, 22 August 2021 at 21:29:35 UTC+2 Ian Lance Taylor wrote:
>>
>> On Sun, Aug 22, 2021 at 12:27 PM Lennart Espe <lennar...@gmail.com> wrote:
>> >
>> > You can run Go 1.17 and use a special compile-time flag. Just use `go build -gcflags=-G=3` and you're good to go.
>> >
>> > gotip should have generics enabled by default as well.
>>
>> Actually please do not try to use the -G=3 support in the Go 1.17
>> release. That has many known problems and nobody is working on them.
>> In particular please do not report bugs against the generics support
>> in 1.17.
>>
>> Please instead try tip. That also has known problems but people are
>> working on them and high quality bug reports are useful.
>>
>> Thanks.
>>
>> Ian
>>
>>
>> > On Sunday, 22 August 2021 at 19:49:48 UTC+2 Serge Hulne wrote:
>> >>
>> >> Is there a preview Golang version I can download to try out generics ?
>> >>
>> >> I have written a library, which I believe would benefit from generics.
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7f884806-8408-444d-9337-6fe98beb60f0n%40googlegroups.com.
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/62ddd635-7995-4abd-a5d2-0d4a0edb7806n%40googlegroups.com.

Rob Pike

unread,
Aug 22, 2021, 7:48:37 PM8/22/21
to Ian Lance Taylor, Serge Hulne, golang-nuts

(But in the normal case you shouldn't have to set GOOS/GOARCH
yourself, the build process should pick the right ones.)

Although this sounds like good advice, my experience suggests that one be explicit. The Apple on-the-fly handling of binary translation means both that you must bootstrap from amd64 binaries, and that that tends to stick. It took a few tries to get arm64 established.

So whatever you do, use the file command after the fact to verify that you have arm64 binaries. The translation is so good that you might well be running amd64 and not know it.

-rob

Reply all
Reply to author
Forward
0 new messages