The Go team has announced the release of Go 1.20, which features four language changes and changes in the implementation of the toolchain, runtime, and libraries.
It also includes a preview for profile-guided optimization (PGO), a new feature that allows the compiler to perform optimizations based on run-time profile information. According to the team, providing a profile can speed up applications by about 3-4%. They hope to improve this further in future releases.
The language changes include the ability to convert a slice to an array, comparable types can now satisfy “comparable” constraints, struct values now get compared one field at a time, and the “unsafe” packages added three new functions: SliceData, String, and StringData.
Some of the tool improvements include the ability of the “cover” tool to collect coverage profiles of whole programs; acceptance of a -pgo flag in the “build,” “go install,” and other commands to enable PGO; and more.
In this release improvements to the compiler and garbage collection have improved CPU performance by up to 2% and reduced memory overhead.
The Go team has also reported that build speeds have been improved by about 10%, bringing them back in alignment to how they were in Go 1.17.
While currently Go 1.20 must be bootstrapped from Go 1.17.13 or later when building from source, the team plans to move the bootstrap toolchain up a year, once per year, in future releases. Another thing to note looking forward is that Go 1.21 won’t support older operating systems such as Windows 7, 8, Server 2008 and Server 2012, macOS 10.13 High Sierra, and 10.14 Mojave.
A comprehensive list of updates can be found in the official release notes.