March 15, 2022
Go 1.18 introduces generics (type parameters, constraints, any/comparable) as a major but proceed-with-caution language change, adds native fuzzing to go test, and ships numerous toolchain, runtime, and library updates including net/netip, go.work workspaces, and stricter compiler checks.
Generics: new syntax for type parameters on functions and types, the ~ token, interface embedding of arbitrary types/unions, and new predeclared identifiers any and comparable — a major backward-compatible language change, but the Go team explicitly cautions against relying on generic code in production due to limited real-world testing
Native fuzzing support: go test gains -fuzz, -fuzztime, -fuzzminimizetime flags and a new testing.F type; fuzz corpus data is cached under $GOCACHE/fuzz and can consume significant disk/memory
go get no longer builds or installs packages in module-aware mode; use 'go install pkg@version' instead, and go get now errors when run outside a module
New go.work workspace mode lets the go command resolve multiple main modules via a go.work file instead of a single go.mod
go build/test/link gain an -asan flag for interoperating with C/C++ code compiled with the address sanitizer
The go command now embeds VCS revision and build-flag info into binaries, readable via 'go version -m', runtime/debug.ReadBuildInfo, or the new debug/buildinfo package
New net/netip package provides a lightweight, immutable, comparable IP address type (Addr, AddrPort, Prefix) as a faster alternative to net.IP, with corresponding net package helper methods
crypto/tls now defaults client-side MinVersion to TLS 1.2 (was TLS 1.0), and crypto/x509 rejects SHA-1-signed certificates by default; both have temporary GODEBUG opt-outs slated for removal
Register-based calling convention (amd64-only in Go 1.17) now extends to arm64, ppc64/ppc64le, and all amd64 OSes, giving roughly 10%+ speedups on arm64/ppc64
Linker emits far fewer relocations, producing faster links, lower memory use, and smaller binaries
New GOAMD64 environment variable (v1-v4) lets you target a minimum AMD64 microarchitecture level at compile time
Compiler is stricter (flags unused variables set only in closures, overflow in rune constants passed to print/println) and, due to generics support, compiles code roughly 15% slower than Go 1.17 with no change to runtime execution speed