Go 1.24, released in February 2025, delivers a substantial update focused on performance, developer productivity, cryptography, and WebAssembly support while maintaining Go 1 backwards compatibility.
Language Enhancements
Generic Type Aliases: Go 1.24 introduces full support for parameterized type aliases, enabling alias definitions like:
type MyAlias[T any] = SomeType[T]
This feature replaces the workaround of empty alias types and will become permanent in Go 1.25; it can still be disabled via GOEXPERIMENT=noaliastypeparams
Toolchain Upgrades
New go tool
module‑scoped directive: With the addition of the tool
directive in go.mod
, managing tool dependencies becomes more robust. Use go get -tool github.com/you/tool
to declare a tool, then go tool toolname
to invoke it. Tool binaries are now cached in build cache.
Vet test analyzer: go vet
now includes a test
analyzer that spots common mistakes in test declarations, fuzzers, benchmarks, and examples.
Structured JSON output: Most go build
/install
/test
commands offer a new -json
flag for machine‑readable build and test result packaging.
Cgo enhancements and annotations: New #cgo noescape
and #cgo nocallback
options allow finer control over pointer semantics and callback behavior. The rules around incompatible declarations have also been tightened.
Runtime and Performance
Benchmarking and runtime improvements reduce CPU overhead by ~2–3% on representative workloads:
- Swiss Tables map implementation: faster and more space efficient.
- Optimized small‑object allocator and an improved internal mutex enhance concurrency and allocation speed.
- You can disable these via
GOEXPERIMENT=noswissmap
ornospinbitmutex
.
Standard Library and Security
- FIPS 140‑3 compliance: Crypto packages now support FIPS‑approved algorithms transparently—no code changes required.
- Library additions from
x/crypto
: includescrypto/sha3
,crypto/pbkdf2
,crypto/hkdf
, and post‑quantum key‑exchangecrypto/mlkem
(ML‑KEM‑768/1024). - Benchmarking API: New loop helper:
for b.Loop() {
// benchmarked logic
}
This simplifies iteration control and reduces misuse or over‑looping.
- Filesystem sandboxing:
os.Root
andos.OpenRoot
allow restricting file system operations to a single directory tree—preventing traversal outside the root.
Memory Management
Improved finalizers: Use runtime.AddCleanup
to attach cleanup callbacks to objects. It supports multiple callbacks, handles circular references more gracefully, and is easier to use than runtime.SetFinalizer
.
Weak pointers: The new weak
package enables weak references, useful for caches and memoization structures.
WebAssembly and WASI
Go 1.24 enhances WASM support with:
go:wasmexport
directive for exporting functions to the host.- Support to build Go programs as WASI libraries or reactors.
Linker and Compiler
Build‑ID/UUID embedding: On ELF targets, the linker embeds a GNU build ID by default; on macOS, it embeds a Mach-O UUID. Use -B none
or -B 0xHEX
to disable or override.
Compiler rigor for cgo types: The compiler now rejects anonymous cgo‑generated types or alias types as method receivers, improving build-time detection of invalid constructs.
Summary
Go 1.24 is an evolutionary release that packs:
- One major language improvement: generic type aliases.
- Substantial toolchain enhancements—
go tool
, vet, JSON logs, cgo controls. - Performance gains through faster maps, allocators, and mutexes.
- Crypto and security—FIPS compliance, SHA‑3, PQC.
- APIs for benchmarking, sandboxed file access, finalizers, weak refs.
- Better WASM/WASI, linker metadata, and stricter cgo checks.
This release improves runtime efficiency, code safety, developer ergonomics, and platform support—all while keeping with Go 1’s backward-compatibility promise.