← All releases

go1.24.0

Major

February 11, 2025

Go 1.24 (Feb 2025) is mostly a toolchain/runtime/library release: full generic type aliases, go.mod tool dependency tracking, faster maps and allocator, a new os.Root sandboxed filesystem API, testing.B.Loop, weak pointers, and new post-quantum/FIPS-oriented crypto packages, all under the usual Go 1 compatibility guarantee.

highlights
  • Generic type aliases are now fully supported (a type alias may be parameterized); disable via GOEXPERIMENT=noaliastypeparams, though that flag disappears in Go 1.25.

  • go.mod gains 'tool' directives to track executable dependencies, replacing the tools.go blank-import hack; new 'go get -tool' and a 'tool' meta-pattern for go get tool/go install tool.

  • go build, go install and go test now support a -json flag for structured JSON build/test output; executables from go run and go tool are now cached in the build cache.

  • go build now automatically stamps binaries with VCS version info (with a +dirty suffix for uncommitted changes); disable with -buildvcs=false.

  • New GOAUTH environment variable provides configurable authentication for private module fetches.

  • Runtime performance improvements (new Swiss Tables-based map implementation, new internal mutex, faster small-object allocation) cut average CPU overhead 2-3%; toggled off via GOEXPERIMENT=noswissmap/nospinbitmutex.

  • New os.Root type and OpenRoot function provide directory-confined filesystem operations that block escaping via absolute paths or symlinks.

  • New testing.B.Loop() method for writing benchmarks, replacing 'for range b.N' loops, running setup/cleanup once and preventing the compiler from optimizing away the loop body.

  • New runtime.AddCleanup offers a more flexible, less error-prone finalizer mechanism than SetFinalizer, complemented by a new weak package for weak pointers.

  • New crypto/mlkem (post-quantum ML-KEM), crypto/hkdf, crypto/pbkdf2, and crypto/sha3 packages; plus FIPS 140-3 compliance mode via the GOFIPS140 env var and fips140 GODEBUG setting.

  • crypto/tls adds Encrypted Client Hello (ECH) support and enables the post-quantum X25519MLKEM768 key exchange by default.

  • New experimental testing/synctest package (GOEXPERIMENT=synctest) lets tests run goroutines in an isolated 'bubble' with a fake clock for deterministic concurrency testing.