Go 1.25 (2025-08-12)
Go 1.25 brings significant improvements to the toolchain, runtime, and standard library, while maintaining Go 1 compatibility.
Language Changes
Go 1.25 introduces no language-level changes affecting Go programs. However, the concept of core types has been removed from the language specification in favor of descriptive prose.
Toolchain
Go Command
-
ASan Leak Detection: The
go build -asanoption now defaults to detecting memory leaks at program exit. Memory allocated by C that is not freed and not referenced by other memory will be reported as an error. Disable this feature by settingASAN_OPTIONS=detect_leaks=0. -
Optimized Tool Dependencies: The Go distribution now includes fewer prebuilt tool binaries. Core toolchain binaries like the compiler and linker remain included, but other tools are built on demand by
go tool. -
ignore Directive: The new
ignoredirective ingo.modspecifies directories that thegocommand should ignore. Files in these directories are excluded during package matching but included in module zip files. -
Enhanced go doc: The
go doc -httpoption starts a documentation server and opens it in a browser window. -
Improved go version: The
go version -m -jsonoption outputs JSON-encodedruntime/debug.BuildInfostructures embedded in Go binaries. -
Module Subdirectory Support: The
gocommand now supports using repository subdirectories as module root paths with<meta name="go-import" content="root-path vcs repo-url subdir">syntax. -
work Package Pattern: A new
workpackage pattern matches all packages in the work module(s). -
Toolchain Line Removal: The
gocommand no longer adds a toolchain line when updating thegoline ingo.modorgo.work.
Vet Tool
New analyzers:
- waitgroup: Reports misplaced calls to
sync.WaitGroup.Add. - hostport: Reports uses of
fmt.Sprintf("%s:%d", host, port)for constructing addresses fornet.Dial, suggestingnet.JoinHostPortinstead.
Runtime
Container-Aware GOMAXPROCS
-
Linux cgroup Awareness: On Linux, the runtime considers the CPU bandwidth limit of the cgroup containing the process. If the limit is lower than the number of logical CPUs,
GOMAXPROCSdefaults to the lower limit. -
Dynamic Updates: The runtime periodically updates
GOMAXPROCSwhen the number of available CPUs or cgroup limits change. -
Disable Mechanism: These behaviors are automatically disabled if
GOMAXPROCSis set explicitly or can be disabled withcontainermaxprocs=0andupdatemaxprocs=0GODEBUG settings.
Experimental Garbage Collector
-
A new garbage collector is available as an experiment. This design improves performance of marking and scanning small objects through better locality and CPU scalability. Benchmark results vary, but expect 10-40% reduction in garbage collection overhead.
-
Enable with
GOEXPERIMENT=greenteagcat build time.
Trace Flight Recorder
-
The new runtime/trace.FlightRecorder API provides a lightweight way to capture runtime execution traces by continuously recording into an in-memory ring buffer.
-
When a significant event occurs, call
FlightRecorder.WriteToto snapshot the last few seconds of the trace to a file.
Panic Output Change
- When a program exits due to an unhandled panic that was recovered and repanicked, the message no longer repeats the panic text.
Previously: panic: PANIC [recovered]\n panic: PANIC
Now: panic: PANIC [recovered, repanicked]
VMA Names on Linux
- On Linux systems with kernel support for anonymous VMA names, the Go runtime annotates anonymous memory mappings with context about their purpose (e.g.,
[anon: Go: heap]). Can be disabled withdecoratemappings=0GODEBUG setting.
Compiler
nil Pointer Bug Fix
- Fixes a compiler bug from Go 1.21 that incorrectly delayed nil pointer checks. Programs that relied on this bug will now correctly panic.
DWARF 5 Support
- The compiler and linker now generate debug information using DWARF version 5. This reduces the space required for debugging information and linking time. Can be disabled with
GOEXPERIMENT=nodwarf5.
Faster Slices
- The compiler can now allocate slice backing stores on the stack in more situations, improving performance. All new stack allocations can be turned off with
-gcflags=all=-d=variablemakehash=n.
Linker
- The linker now accepts a
-funcalign=Ncommand line option to specify function entry alignment.
Standard Library
New testing/synctest Package
-
The new testing/synctest package provides support for testing concurrent code.
-
The Test function runs tests in an isolated "bubble" with virtualized time.
-
The Wait function waits for all goroutines in the current bubble to block.
This package was first available in Go 1.24 under GOEXPERIMENT=synctest. The experiment has now graduated to general availability.
New Experimental encoding/json/v2 Package
-
Go 1.25 includes a new experimental JSON implementation, enabled by setting
GOEXPERIMENT=jsonv2at build time. -
Two new packages are available:
- encoding/json/v2: A major revision of the
encoding/jsonpackage. - encoding/json/jsontext: Lower-level JSON syntax processing.
- encoding/json/v2: A major revision of the
-
The new implementation performs substantially better than the existing one under many scenarios. Decoding is substantially faster.
Other Standard Library Improvements
-
archive/tar:
Writer.AddFSnow supports symbolic links for filesystems implementingio/fs.ReadLinkFS. -
crypto: New
MessageSignerinterface andSignMessagefunction for signers that hash messages themselves. -
crypto/ecdsa: New low-level encoding functions:
ParseRawPrivateKey,ParseUncompressedPublicKey,PrivateKey.Bytes, andPublicKey.Bytes. FIPS 140-3 signing is now 4x faster. -
crypto/ed25519: FIPS 140-3 signing is now 4x faster.
-
crypto/rsa: Key generation is now 3x faster.
-
crypto/sha1: Hashing is now 2x faster on amd64 with SHA-NI instructions.
-
crypto/sha3: Hashing is now 2x faster on Apple M processors. New
SHA3.Clonemethod. -
crypto/tls: New
ConnectionState.CurveIDfield andConfig.GetEncryptedClientHelloKeyscallback. SHA-1 signatures are now disallowed in TLS 1.2 (can be re-enabled withtlssha1=1). -
crypto/x509: Support for
crypto.MessageSignerinterface.CreateCertificatenow uses truncated SHA-256 forSubjectKeyId. -
go/ast: New
PreorderStackfunction for AST traversal with node stack. -
go/token: New
FileSet.AddExistingFilesmethod. -
go/types:
Varnow has aKindmethod. NewLookupSelectionfunction. -
hash: New
XOFinterface for extendable output functions. All standard library Hash implementations now implementCloner. -
io/fs: New
ReadLinkFSinterface for reading symbolic links. -
net:
LookupMXnow returns DNS names that look like IP addresses. WindowsListenMulticastUDPnow supports IPv6. Windows now implementsFileConn,FilePacketConn, andFileListener. -
net/http: New
CrossOriginProtectionimplements CSRF protections using Fetch metadata. -
os: Windows
NewFilenow supports asynchronous I/O handles.DirFSandRoot.FSimplementio/fs.ReadLinkFS.Roothas new methods for file operations. -
reflect: New
TypeAssertfunction for direct type assertions without allocations. -
regexp/syntax:
\p{name}and\P{name}now accept more names and case-insensitive lookups. -
runtime:
AddCleanupcleanup functions are now executed concurrently and in parallel. NewSetDefaultGOMAXPROCSfunction. Newcheckfinalizers=1GODEBUG setting for diagnostics. -
sync: New
WaitGroup.Gomethod simplifies goroutine creation and counting. -
testing: New
T.Attr,B.Attr, andF.Attrmethods for emitting test attributes. NewOutputmethod.AllocsPerRunnow panics if parallel tests are running. -
unique: More eager, efficient, and parallel value reclamation.
Platform Support
Darwin (macOS)
- Go 1.25 requires macOS 12 Monterey or later. Support for previous versions is discontinued.
Windows
- Go 1.25 is the last release containing the broken 32-bit windows/arm port. It will be removed in Go 1.26.
AMD64
- In
GOAMD64=v3mode or higher, the compiler now uses fused multiply-add instructions for faster and more accurate floating-point arithmetic.
Loong64
- The linux/loong64 port now supports the race detector, cgo traceback, and internal linking mode.
RISC-V
- The linux/riscv64 port now supports the
pluginbuild mode. - The
GORISCV64environment variable accepts a new valuerva23u64for the RVA23U64 user-mode profile.
References
For more details, see the official release notes: Go 1.25 Release Notes