Six months after the release of Go 1.19, Go 1.20 is now officially released, and theMost of the changes have been focused on the implementation of the toolchain, runtime, and libraries.

download link:

Go 1.20 was the last version to run on any version of Windows 7, 8, Server 2008 and Server 2012, Go 1.21 will require at least Windows 10 or Server 2016. And while Go 1.20 was the last version to support running on macOS 10.13 High Sierra or 10.14 Mojave, Go 1.21 will require macOS 10.15 Catalina or later. Additionally, Go 1.20 adds support for FreeBSD on RISC-V (GOOS=freebsd, GOARCH=riscv64) for experimental support.

Go 1.20 includes 4 changes in syntax:

  • Go 1.7 added the function of converting from slice (slicing) to array pointer, and Go 1.20 has extended this function – it can be directly converted from slice to array. For example, given a slicex,[4]byte(x) can be written as *(*[4]byte)(x).
  • standard libraryunsafeThe package defines 3 new functions:SliceData,String and StringData.with Go 1.17SliceTogether, these functions now provide full functionality for constructing and deconstructing slice and string values ​​without relying on their precise representation.
  • The Go language specification has been updated to define that the value of a structure variable only compares one field at a time, and the order of field comparison is consistent with the order in which the fields are defined in the structure. Once the value comparison of a certain field is inconsistent, the comparison will stop immediately.
  • Comparable type(such as ordinary interfaces ordinary interfaces) can now satisfy comparable Constraints, even if the type arguments are not strictly comparable types.

Some other updates include:

  • The $GOROOT/pkg directory no longer stores precompiled package archives for standard archives in order to reduce the size of the Go distribution.
  • The go command now defines architecture feature build flags, such as amd64.V2, to allow package implementation files to be selected based on the presence or absence of specific CPU architecture features. This is good news for x86_64 microarchitecture feature level work.
  • go build and go install and other build-related commands now support a “-cover” flag for enabling builds with code coverage instrumentation.
  • Reduced memory overhead and increased CPU performance by up to 2% due to work on the garbage collector.
  • Preview support for Profile Guided Optimizations (PGO).
  • On Linux, the linker now chooses a dynamic interpreter for glibc or musl at link time.
  • A new crypto/ecdh package providing explicit support for Elliptic Curve Diffie-Hellman key exchange on NIST curves and Curve25519.

More details can be found in the official announcement.

#Officially #Released #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *