Go release 1.20

Introduction to Go 1.20

Go 1.20 arrives six months after Go 1.19 with most changes in the toolchain, runtime, and libraries. It maintains the Go 1 compatibility promise.

Changes to the language

  • Conversions from slice to array are now allowed.
  • Three new functions in the unsafe package: SliceData, String, and StringData.
  • Struct and array comparisons are now well-defined, stopping at the first mismatch.
  • Comparable types can satisfy comparable constraints even if type arguments are not strictly comparable.

Ports

  • Last release for Windows 7, 8, Server 2008 and Server 2012. Future versions will require Windows 10 or Server 2016.
  • Last release for macOS 10.13 High Sierra or 10.14 Mojave. Future versions will require macOS 10.15 Catalina or later.
  • Experimental support for FreeBSD on RISC-V.

Tools

  • Standard library package archives are no longer stored in $GOROOT/pkg.
  • Improved robustness for go test -json implementation.
  • Support for architecture feature build tags.
  • go commands accept -C <dir> to change directory before performing the command.
  • Profile-guided optimization (PGO) and code coverage instrumentation with the -cover flag.

Runtime

  • Garbage collector's internal data structures reorganized for better efficiency.
  • Less erratic behavior in garbage collector with respect to goroutine assists.
  • New runtime/coverage package for writing coverage profile data at runtime.

Compiler

  • Preview support for profile-guided optimization (PGO).
  • Compiler front-end upgraded for better handling of internal data and generics.
  • Compiler now rejects anonymous interface cycles by default.
  • Improved build speeds by up to 10%, reverting to Go 1.17 performance levels.

Linker

  • On Linux, dynamic interpreter selected at link time for glibc or musl.
  • On Windows, support for modern LLVM-based C toolchains.
  • Compiler-generated symbols now use go: and type: prefixes to avoid user package confusion.

Bootstrap

  • Go 1.20 requires Go 1.17.13 for bootstrapping.
  • Future versions plan to move the bootstrap toolchain forward approximately once a year.

Core library

  • New crypto/ecdh package for Elliptic Curve Diffie-Hellman key exchanges.
  • Support for wrapping multiple errors in errors package.
  • New ResponseController type in net/http for extended per-request functionality.
  • New ReverseProxy Rewrite hook in net/http/httputil for more secure and flexible proxy requests.