Go 1.27 lands this month. The release notes are long; these are the changes I actually care about.
Generic methods
The headline: methods can finally declare their own type parameters. Helpers that used to be package-scoped functions can now live on the type they belong to.
type Set[E comparable] struct{ m map[E]struct{} }
func (s *Set[E]) Map[T comparable](f func(E) T) *Set[T] {
out := &Set[T]{m: make(map[T]struct{}, len(s.m))}
for e := range s.m {
out.m[f(e)] = struct{}{}
}
return out
}
One catch: interface methods cannot declare type parameters, so you cannot abstract over generic methods with an interface.
encoding/json/v2
A full revision of encoding/json, on by default. Stricter than v1 —
it rejects invalid UTF-8 and duplicate object keys — and unmarshaling
is significantly faster. The new encoding/json/jsontext package
exposes the low-level token stream. Old code keeps working;
GOEXPERIMENT=nojsonv2 opts out if something breaks.
Cheaper small allocations
The compiler now emits size-specialized allocation routines: small allocations (under 80 bytes) get up to 30% cheaper for ~60 KB of binary size. Free performance for allocation-heavy code — most Go services, in practice.
Goroutine leak profiles
runtime/pprof gains a goroutineleak profile, generally available
after being experimental. It finds goroutines blocked on concurrency
primitives nothing else can reach:
curl localhost:6060/debug/pprof/goroutineleak
Leaked goroutines used to mean staring at full goroutine dumps and guessing which of them would never wake up. Now there’s a profile that answers exactly that question.
Grab bag
- New
uuidpackage in the standard library — one less dependency. strings.CutLastandbytes.CutLastcomplete theCutfamily.crypto/mldsabrings post-quantum signatures (FIPS 204), and TLS gainsMLKEM1024plus ML-DSA signature schemes.- Experimental portable SIMD under
GOEXPERIMENT=simd. timepackage channels are now always unbuffered; theasynctimerchanescape hatch is gone.
Upgrade motivation ranked: allocation speedup for free, json/v2 for correctness, generic methods for API design headroom.