Update
Feb 1, 2023
tracked by
Updatify
Introduction to Go 1.20
The latest Go release, version 1.20, arrives six months after Go 1.19.
Most of its changes are in the implementation of the toolchain, runtime, and libraries.
As always, the release maintains the Go 1 promise of compatibility.
We expect almost all Go programs to continue to compile and run as before.
Changes to the language
Go 1.20 includes four changes to the language.
Go 1.17 added conversions from slice to an array pointer.
Go 1.20 extends this to allow conversions from a slice to an array:
given a slice x, [4]byte(x) can now be written
instead of *(*[4]byte)(x).
The unsafe package defines
three new functions SliceData, String, and StringData.
Along with Go 1.17’s Slice, these functions now provide the complete ability to
construct and deconstruct slice and string values, without depending on their exact representation.
The specification now defines that struct values are compared one field at a time,
considering fields in the order they appear in the struct type definition,
and stopping at the first mismatch.
The specification could previously have been read as if
all fields needed to be compared beyond the first mismatch.
Similarly, the specification now defines that array values are compared
one element at a time, in increasing index order.