Go 1.27 Interactive Tour

victoriametrics.com

276 points by Hixon10 13 hours ago


baalimago - 7 hours ago

This: "(b Box[T]) Map[U any](f func(T) U) Box[U]" is the type of cognitive weight I was happy that Go avoided.

chenxiaolong - 12 hours ago

This release also fixes runtime.findnull() to be compatible with MTE on Android ([1] and [2]). This was the only thing preventing MTE from being enabled for apps that use gomobile on MTE-compatible Android OS's like GrapheneOS.

[1] https://go-review.googlesource.com/c/go/+/749062

[2] https://go-review.googlesource.com/c/go/+/751020

mappu - 11 hours ago

Automatically draining http response bodies is a risky silent behaviour change. I think it will be an improvement for most applications, but it's very subtle if you were relying on the old behaviour

KolmogorovComp - 17 minutes ago

Instead of having each language bring progress in a different and/or novel, we get this, old java features that comes 20 years-in after the making.

They're probably useful, but clearly not sexy (as golang in general).

sbstp - 10 hours ago

Go's standard library has always been it's strength, especially the crypto package! Lovely stuff.

my-next-account - 7 hours ago

>The quieter but bigger change

I really wish they didn't use such stupid LLM-isms.

nu2ycombinator - 12 hours ago

Those Generics syntax in Golang seems so hard to read.

mayama - 10 hours ago

Adding simd in std and even being used in map is nice. Would have to look for places to experiment with it in hot loops in code I have.

Hixon10 - 13 hours ago

Some examples for the upcoming release https://go.dev/doc/go1.27

fweimer - 6 hours ago

> interfaces still can’t declare type-parameterized methods

What would an implementation look like? Wouldn't it be quite different from the existing one because it has to rely heavily on indirection because (limited) monomorphimization is not possible?

lilbigdoot - 12 hours ago

This level of generics actually has me interested a bit in Go now.

Altern4tiveAcc - 3 hours ago

>func (b Box[T]) Map[U any](f func(T) U) Box[U] {}

That's completely unreadable.

rednafi - 4 hours ago

I am all for using LLMs to generate value but a little more editorial review can't hurt.

> The quieter but bigger change: the classic encoding/json (v1) package is now backed by the v2 implementation under the hood.

This is fantastic content nevertheless.

drivebyhooting - 11 hours ago

Can generics be used to improve error handling and eliminate the if err pattern?

theplumber - 10 hours ago

This is quite of a big release and I like the new methods on generics.

nothrows - 10 hours ago

generics were a slippery slope. give it a decade and Go will be indistinguishable from c++

kansm - 9 hours ago

Tried running a couple of examples in the tour, but ran into a few errors.

stingraycharles - 12 hours ago

Am I the only one who’s absolutely shocked that Go finally is embracing generics?

Does anyone have a bit of an inside view into what changed in the perspectives of the language maintainers?

I’m not buying the “it took us 20 years to understand how to do it correctly” argument, as this is something you explicitly take into consideration when designing the language or not. And it was specifically not a part of language design, and is much harder to retrofit (backwards compatibility).

So what changed?

cat-whisperer - 8 hours ago

does go have enums?

smalljelly2018 - 6 hours ago

[flagged]

fang2hou - 11 hours ago

[dead]

okzgn - 11 hours ago

[dead]

vladsiu - 7 hours ago

[dead]

pixxxel - 8 hours ago

Let's GO

adrianmsmith - 4 hours ago

One thing I think generics in Go is missing is the <?> concept in Java.

If you're taking a List[T] and all you want to do is to call list.size() then you don't care what type of list it is. In Java you can write a function which takes a List<?> but in Go you have to write List[T] so then the question becomes what is T? You have to make the function (or type you're a method on) generic. If you make the type generic then every user of your type also needs to specify T, etc.

I don't think it would be impossible to add that to Go. Allow List[?], which matches a List with any type parameter. Calling functions which don't involve the type parameter like list.size() would be fine, calling a method returning the type parameter like list.get(n) would return "any", and methods taking the type parameter like list.set(n, obj) would probably not be callable.