Go 1.27
This overview applies when the project's target Go version is at least 1.27.
Language
- Methods may declare their own type parameters. Interface methods cannot declare type parameters, and generic methods cannot implement interface methods.
- Keys in struct literals may be field selectors, including selectors that name fields within embedded structs.
- Generic function type inference applies whenever a function is assigned or converted to a matching function type.
Tools and modules
- The
compile,link,asm,cgo,cover, andpacktools accept GCC-style response files through@filearguments. - The
gocommand no longer fetches modules from Bazaar (bzr) servers. - Removed
GODEBUGsettings remain accepted ingo.modand//go:debugonly when set to their final default. Earlier values cause the build to fail. go testruns thestdversionvet check by default. It identifies standard library symbols newer than the version selected by the module and file tags.go test -jsonoutput events may includeOutputTypevalues such aserror,error-continue, andframe.go docacceptspackage@version;-exlists executable examples and a named example includes its source and comments.go fixadds theatomictypes,embedlit,slicesbackward, andunsafefuncsmodernisers. Thefmtappendfanalyser is removed, andwaitgroupis renamed towaitgroupgo.go mod tidyfor modules at Go 1.27 or later consolidates requirements into at most one direct and one indirect block while preserving associated comments.- A port-only
go tool trace -http=:6060address binds to localhost. An explicit address such as0.0.0.0:6060exposes it on all interfaces.
Runtime and diagnostics
- Tracebacks include
runtime/pprofgoroutine labels for Go 1.27 modules.GODEBUG=tracebacklabels=0disables them when labels contain sensitive data. - Time package channels are always synchronous. The
asynctimerchancompatibility setting is permanently removed. - The
goroutineleakprofile and/debug/pprof/goroutineleakendpoint are generally available. Detection is reachability-based and cannot identify every permanently blocked goroutine;GOEXPERIMENT=goroutineleakprofileis removed. - Size-specialised allocation is enabled for small allocations and adds roughly
60 KB to binaries.
GOEXPERIMENT=nosizespecializedmallocis a temporary opt-out expected to disappear in Go 1.28.
Standard library
encoding/json/v2supplies option-based marshal and unmarshal APIs, including reader, writer, encoder, and decoder forms. Its defaults reject invalid UTF-8 and duplicate object names.encoding/json/jsontextprovides token- and value-level JSON processing with stateful validation. Numeric token accessors return errors.encoding/jsonis backed by the v2 implementation while retaining v1 behaviour and support; error text may differ. Compatibility options expose v1 semantics, andGOEXPERIMENT=nojsonv2temporarily restores the old implementation.crypto/mldsaimplements FIPS 204 ML-DSA.crypto/x509supports ML-DSA keys and signatures, and TLS 1.3 supports the ML-DSA signature schemes.uuidgenerates and parses UUIDs.bytes.CutLastandstrings.CutLastsplit around the last separator occurrence, covering commonLastIndexpatterns.compress/flatemay produce different valid bytes, affecting ZIP, gzip, zlib, and PNG output derived from it.crypto/tls.Config.Randis deprecated;testing/cryptotest.SetGlobalRandomprovides deterministic randomness for tests.MLKEM1024is available throughCurvePreferences, andConnectionState.LocalCertificatereports the chain presented to the peer.crypto/x509.SystemCertPoolhonoursSSL_CERT_FILEandSSL_CERT_DIRon Windows and Darwin, selecting the Go verifier when either is set.database/sql.ConvertAssignexposesRows.Scanconversions to drivers, whiledriver.RowsColumnScannerpermits direct scanning into caller destinations.go/types.HasherandHasherIgnoreTagshash types according to the corresponding identity relations. The removedgotypesaliassetting means alias declarations always produceAliasnodes.hash/maphash.Hasherdefines hashing and equality for a type;ComparableHasherimplements that contract for comparable values.math/big.Int.Dividecomputes quotient and remainder with truncation, floor, round, or ceiling modes.math/rand/v2.Rand.Nis the method form ofN.- Unix connection reads return
io.EOFdirectly rather than a wrappingnet.OpErrorwhen the underlying read reaches EOF. - HTTP/2 servers honour RFC 9218 client priority signals unless
Server.DisableClientPriorityis set. Closing an HTTP/1 response body drains a bounded amount of unread content to improve connection reuse. http.Server.MaxHeaderValueCountlimits accepted header values.httptest.NewTestServeruses an in-memory network compatible withtesting/synctest.url.URL.Cloneandurl.Values.Clonemake deep copies.testing/synctest.Sleepcombinestime.Sleepwithsynctest.Wait.- Unicode support advances from Unicode 15 to Unicode 17.
Experimental features
GOEXPERIMENT=simdenables the experimental portable, vector-size-agnosticsimdpackage. Its operations use hardware instructions where available.- The same experiment enables the unstable, non-portable
simd/archsimdpackage. It supports amd64, arm64 Neon, and WebAssembly vector operations with APIs tied to each architecture.
Compatibility and platforms
- Relative filenames in
//lineand/*line*/directives resolve from the containing source file's directory. - Closure symbol names are simpler and may be shared across inlined instances. Tests that inspect those symbols can observe different names, and function code pointers remain unsuitable for comparing closures.
- The
tlsunsafeekm,tlsrsakex,tls3des,tls10server, andx509keypairleafGODEBUGcompatibility settings are permanently removed. - macOS builds require macOS 13 Ventura or later.
- Linux
ppc64uses the ELFv2 ABI. Cgo, position-independent executables, and external linking require an ELFv2-compatible runtime and Linux kernel support.