Go 1.26 is not out yet, but the release notes draft is already up. There are a bunch of changes, but two of them that I find super interesting are
newcan now take an expression as the initial value
We can now pass an expression directly to new to set the initial value. This is nice when dealing with serialization libraries like encoding/json or protobufs, where pointers are often used to represent optional fields.
Instead of writing helper functions or doing multi-line setup, we can now just write something like new(yearsSince(born)) [example taken from the release notes as is] and be done with it. Much cleaner and easier to read.
- Green Tea GC is now the default
The Green Tea garbage collector, which was experimental in Go 1.25, is now enabled by default in Go 1.26. Some key highlights of this GC -
- 10-40% lower GC overhead in real-world programs
- 10% extra improvement due to vectorized scanning of small objects
There is more in the release notes, but these were the two changes I found interesting. The full (still draft) release notes are linked below if you want to dig in.