Hacker News new | ask | show | jobs
by narraturgy 1690 days ago
As someone who has recently decided to learn Go, this is a rather intimidating change. What is a good way to know that I am learning from sources who are using these new tools responsibly, rather than applying them in the messy fashion which you seem concerned about?
2 comments

Stick close to the standard library and the extended libraries (https://pkg.go.dev/golang.org/x ), track a community list where a lot of discussion will be occurring very quickly after release.

I don't want to recommend "don't use generics", but generally think about whether or not you can solve the problem without them without immediately reaching for them. There are patterns in Go that work just fine today, which is why despite the fact that clearly some people are just flabberghasted at the idea that Go is useful without generics, it demonstrably is. Interfaces are quite a lot of what you need out of "generics". Don't just give up and copy and paste; it is necessary way less than some people who were trying to write C++ in Go claim it is.

this. Interfaces do 90% of what generics are used for in other languages. The remaining 10% had been solved by boilerplate/generation. Yes, it will be nice to have a better answer for that 10%. But we'll probably end up with generics being used (badly) for 90% of cases instead.

As always in Go, follow the standard library. If they're hesitating to use generics, then that's solid advice.

The standard library should be a good starting point.