5 ms·
Go has had generic forms of the `min` and `max` functions as builtins since 1.21. https://pkg.go.dev/builtin#max https://pkg.go.dev/builtin#max
by pyth0 3y ago
Go has had generic forms of the `min` and `max` functions as builtins since 1.21.
https://pkg.go.dev/builtin#max https://pkg.go.dev/builtin#max
- j1elo 3y agoGo 1.21 is the version from which it is noticeable that they are pushing towards (re)implementing things that were lacking before due to missing support for generics. Like the new slices package, meant to do common operations on slices, that is brand new on 1.21. I wouldn't be surprised to see more and more new additions leveraging generics in next releases.
- vitus 3y agoGood to know! I admittedly haven't written much Go in the past year, and while min / max were some of the most egregious examples, I'm sure there are plenty more that still exist.