Go 1.26 Highlights: Green Tea GC, go fix Modernizers, and Language Tweaks
Go 1.26 (February 2026) is a toolchain release where runtime and developer tooling matter as much as syntax.
Search across all documentation pages
Go 1.26 (February 2026) is a toolchain release where runtime and developer tooling matter as much as syntax.
Green Tea GC reduces collector overhead by default.
go fix became a push-button modernization pipeline.
Small language tweaks like new(expr) remove years of helper-function boilerplate.
Go 1.26 ships Green Tea GC as the default garbage collector, a rebuilt go fix with modernizers, and targeted language/stdlib improvements.
SMEs should plan upgrades around GC latency validation, automated idiomatic refactors, and optional-field struct patterns.
Experimental features (goroutine leak profiles, simd/archsimd, runtime/secret) exist for early adopters but are not required for most services.
Quick-reference upgrade card for Go 1.26.
# 1. Bump module language version
go get go@1.26.0 && go mod tidy
# 2. Preview modernizers
go fix -diff ./...
# 3. Apply and test (run twice for synergistic fixes)
go fix ./... && go test ./...
go fix ./... && go test ./...
# 4. Rollback GC only if investigating regression
GOEXPERIMENT=nogreenteagc go build -o app ./cmd/appWhen to reach for this:
runtime.gc samplesOptional API fields with new(expr), then modernize surrounding code with go fix.
package api
import (
"encoding/json"
"time"
)
type Person struct {
Name string `json:"name"`
Age *int `json:"age,omitempty"`
}
func PersonJSON(name string, born time.Time) ([]byte, error) {
return json.Marshal(Person{
Name: name,
Age: new(yearsSince(born)), // Go 1.26: new accepts expressions
})
}
func yearsSince(t time.Time) int {
return int(time.Since(t).Hours() / (365.25 * 24))
}# After bumping go.mod to 1.26:
go fix -newexpr ./...
go fix -stringscut -minmax ./...
go vet ./...
go test ./...// Before go fix (older style) - modernizers may rewrite:
// eq := strings.IndexByte(pair, '=')
// result[pair[:eq]] = pair[1+eq:]
// After stringscut modernizer:
// before, after, _ := strings.Cut(pair, "=")
// result[before] = afterWhat this demonstrates:
new(expr) removes newInt-style helpers for optional pointer fieldsgo fix -newexpr rewrites helpers and call sites across packagesstringscut, minmax, mapsloop) run in the same commandgo vet still catches issues modernizers do not addressGreen Tea replaces the classic per-object graph flood mark phase with page-oriented scanning.
Instead of hopping between scattered small objects, the collector accumulates work per heap page, scanning objects in memory order.
Benefits:
Benchmarks vary; many programs see 10-40% less GC CPU time, with ~10% as a common case.
On newer amd64 hardware, an additional ~10% GC improvement is expected from vector instructions.
Rollback: GOEXPERIMENT=nogreenteagc at build time.
Opt-out is expected to be removed in Go 1.27.
Validate p99 latency and runtime/metrics GC fractions after upgrading.
Go 1.26 rewrote go fix on the golang.org/x/tools/go/analysis framework shared with go vet.
Fixers must be behavior-preserving (performance and style improvements allowed).
Dozens of modernizers ship, including:
| Analyzer | What it does |
|---|---|
any | interface{} -> any |
minmax | if-chains -> min/max |
mapsloop | manual map loops -> maps package |
stringscut | Index+slice -> strings.Cut |
forvar | removes pre-1.22 x := x loop shadowing |
newexpr | helper wrappers -> new(expr) |
inline | applies //go:fix inline API migrations |
Workflow tips:
go fix commit-diff first on large reposgo fix -minmax ./...) to split review loadminmax then nested min) appear in pass twoList analyzers: go tool fix help
new(expr) - new now accepts expressions, not only types.
Critical for optional pointer fields in JSON, protobuf, and database models.
Self-referential generic constraints - generic types may reference themselves in constraint lists, enabling patterns like Adder[A Adder[A]].
GOEXPERIMENT=norandomizedheapbase64)GOEXPERIMENT=goroutineleakprofileerrors.AsType generic helperlog/slog.NewMultiHandler for fan-out logging# CI matrix: run go fix under representative GOOS/GOARCH if you use build tags
GOOS=linux GOARCH=amd64 go fix ./...
GOOS=darwin GOARCH=arm64 go fix ./...nogreenteagc only while investigating.go fix on huge repos - Synergistic and import-cleanup fixes need a second run. Fix: go fix ./... twice; fix compile errors from semantic conflicts manually.go directive - Modernizers gate on effective Go version. Fix: go get go@1.26.0 before expecting newexpr fixes.new identifier - newexpr skips unsafe rewrites when new is redeclared locally. Fix: Rename local new bindings before running fixer.go vet and integration tests in the upgrade pipeline.| Alternative | Use When | Don't Use When |
|---|---|---|
GOEXPERIMENT=nogreenteagc | Suspected GC regression during canary | Long-term production strategy (removal in 1.27) |
| gopls quick fixes only | Small active files in IDE | Repo-wide upgrade after toolchain bump |
| Manual refactor | Critical code paths needing human design | Hundreds of repetitive idiom updates |
Stay on Go 1.25 + greenteagc experiment | Need time before full 1.26 adoption | You want vector-accelerated GC and go fix suite |
A page-oriented mark-phase garbage collector that improves locality when scanning small objects.
Default in Go 1.26 after experimentation in Go 1.25.
Depends on allocation rate and object size distribution.
Many workloads see 10-40% less GC CPU; overall app speedup is usually smaller than GC fraction.
Historical fixers were removed as obsolete.
Go 1.26 go fix uses the modern analysis framework and modernizers.
Run on upgrade branches, not every PR.
Treat output like gofmt: review the dedicated modernization commit.
Helpers like func intPtr(v int) *int { return &v } and protobuf-style wrapper calls for simple literals.
Designed to preserve behavior; edge cases can cause compile errors (e.g., unused locals).
Always run tests after fixing.
An API owner directive for the inline analyzer to migrate callers to renamed or refactored functions automatically.
Expected in Go 1.27 per release notes.
Plan to validate Green Tea before then.
Yes.
Go 1.26 requires Go 1.24.6 or later to build the toolchain itself.
Goroutine leak profile in staging CI if you fight leaked goroutine incidents.
Skip simd/archsimd unless you have numerical hot paths and hardware expertise.
Stack versions: This page was written for Go 1.26.x (Green Tea GC default, go fix modernizers - verify patch at build), chi (latest - verify at build), gin (latest - verify at build), echo (latest - verify at build), google.golang.org/grpc (latest - verify at build), sigs.k8s.io/controller-runtime (latest - verify at build), kubebuilder (latest - verify at build), tinygo (latest - verify board targets at build), wazero (latest - verify at build), and golangci-lint (latest - verify linter set at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026