← All releases

go1.23.0

Major

August 13, 2024

Go 1.23 adds range-over-func iterators as a language feature, a preview of generic type aliases, an opt-in telemetry system, new unique/iter/structs packages, and changes Timer/Ticker GC and channel behavior (version-gated via go.mod).

highlights
  • for-range loops now accept iterator functions (func(func() bool), func(func(K) bool), func(func(K,V) bool)) as range expressions, per the new iter package

  • Preview support for generic type aliases, enabled within a package via GOEXPERIMENT=aliastypeparams (cross-package use not yet supported)

  • New opt-in Go telemetry system (go telemetry command) collects toolchain usage/breakage stats locally by default, with weekly upload if opted in

  • Timer and Ticker are now GC-eligible immediately even if Stop isn't called, and their channels are now unbuffered (cap 0), fixing Reset/Stop races; only applies to modules with go.mod go1.23+ (revert via GODEBUG=asynctimerchan=1)

  • New unique package for canonicalizing/interning comparable values via Make[T] and Handle[T]

  • New iter package plus iterator-related additions to slices (All, Values, Backward, Collect, Sorted, Chunk, etc.) and maps (All, Keys, Values, Insert, Collect)

  • New structs package with HostLayout marker for structs whose layout must match host platform conventions

  • go vet adds the stdversion analyzer, flagging use of stdlib symbols too new for the file's effective Go version

  • Linker now restricts //go:linkname references to unexported stdlib/runtime symbols unless explicitly marked for it (disable via -checklinkname=0)

  • crypto/tls adds Encrypted Client Hello support, removes 3DES from default cipher suites, and enables the post-quantum X25519Kyber768Draft00 key exchange by default

  • New go mod tidy -diff and go env -changed flags, plus a godebug directive supported in go.mod/go.work files

  • PGO build-time overhead cut from 100%+ to single digits, and the compiler now overlaps stack frame slots of local variables to reduce stack usage