Go 1.26: Everything That Changed in the New Version
Hey everyone!
Go 1.26 arrived in February 2026, six months after Go 1.25. And it came with changes that will directly impact performance and the way you write Go code.
The main highlight is the new Green Tea garbage collector, now enabled by default. But thereβs a lot more interesting stuff in this version.
Letβs see what really changed.
What youβll find here
This version brings changes in four main areas:
- Language changes: more powerful
new, more flexible generics - New garbage collector: Green Tea GC by default
- Modernized tools:
go fixcompletely rewritten - Library improvements: various stdlib improvements
Each section covers what changed and the practical impact for your day-to-day work.
1. Language changes
new accepts expressions as operand
The built-in new function now allows its operand to be an expression, specifying the initial value of the variable.
This is especially useful when working with serialization packages like encoding/json or protocol buffers that use pointers to represent optional values:
1
2
3
4
5
6
7
8
9
10
11
type Person struct {
Name string `json:"name"`
Age *int `json:"age"` // age if known; nil otherwise
}
func personJSON(name string, born time.Time) ([]byte, error) {
return json.Marshal(Person{
Name: name,
Age: new(yearsSince(born)), // before, needed an auxiliary variable
})
}
Before, you needed to create an auxiliary variable:
1
2
3
// Before Go 1.26
age := yearsSince(born)
person := Person{Name: name, Age: &age}
Now itβs much cleaner and more direct.
Generics: types can self-reference in parameter list
The restriction that a generic type may not refer to itself in its type parameter list has been lifted.
Itβs now possible to specify type constraints that refer to the generic type being constrained:
1
2
3
4
5
6
7
type Adder[A Adder[A]] interface {
Add(A) A
}
func algo[A Adder[A]](x, y A) A {
return x.Add(y)
}
Previously, the self-reference to Adder on the first line was not allowed. This makes type constraints more powerful and simplifies the spec rules for type parameters.
2. New garbage collector: Green Tea GC
What is the Green Tea GC
The Green Tea garbage collector, previously available as an experiment in Go 1.25, is now enabled by default in Go 1.26.
This new GC improves the performance of marking and scanning small objects through better memory locality and CPU scalability.
Performance impact
Benchmark results vary, but the expectation is:
1
2
3
4
5
6
7
βββββββββββββββββββββββββββββββββββββββββββ
β Reduction in GC overhead β
β β
β General: 10β40% less overhead β
β Modern CPUs: +10% additional β
β (Intel Ice Lake / AMD Zen 4 or newer) β
βββββββββββββββββββββββββββββββββββββββββββ
On modern CPUs (Intel Ice Lake or AMD Zen 4 and newer), the GC leverages vector instructions for scanning small objects, adding ~10% more improvement.
How to disable (if needed)
If you encounter any performance or behavior issues, you can disable it:
1
GOEXPERIMENT=nogreenteagc go build .
Note: This opt-out setting will be removed in Go 1.27. If you need to disable it for any reason, please report the issue at github.com/golang/go.
Other runtime improvements
Faster cgo calls: The baseline runtime overhead of cgo calls has been reduced by ~30%.
Heap base address randomization: On 64-bit platforms, the runtime now randomizes the heap base address at startup. This is a security enhancement that makes it harder for attackers to predict memory addresses when using cgo.
Goroutine leak profile (experimental): A new profile type that reports leaked goroutines is now available as an experiment:
1
GOEXPERIMENT=goroutineleakprofile go build .
A βleakedβ goroutine is one blocked on a concurrency primitive (channels, sync.Mutex, sync.Cond, etc.) that cannot be unblocked. The runtime detects this using the garbage collector.
3. Tools: go fix completely rewritten
The new go fix
go fix has been completely revamped and is now the home of Goβs modernizers. It provides a reliable, push-button way to update Go code bases to the latest idioms and core library APIs.
The initial suite of modernizers includes:
- Dozens of fixers to use modern language and library features
- A source-level inliner that allows automating API migrations using
//go:fix inlinedirectives
1
2
# Automatically modernizes your code
go fix ./...
Important: These fixers should not change the behavior of your program.
The new go fix is built on the same analysis framework as go vet. This means the same analyzers that provide diagnostics in go vet can be used to suggest and apply fixes in go fix.
Other tool changes
go mod init with lower version by default: Now creates go.mod with a previous version to encourage compatibility with supported versions:
1
2
Go 1.26 β creates go.mod with go 1.25.0
Go 1.26 RC β creates go.mod with go 1.24.0
cmd/doc removed: The go tool doc command has been removed. Use go doc as a direct replacement (same flags and behavior).
pprof with flame graph by default: The pprof web UI now shows the flame graph by default when using -http. The previous view is still available at βView β Graphβ.
4. Library improvements
log/slog: MultiHandler
New NewMultiHandler function that creates a handler invoking multiple handlers:
1
2
3
4
5
handler := slog.NewMultiHandler(
slog.NewJSONHandler(os.Stdout, nil),
slog.NewTextHandler(logFile, nil),
)
logger := slog.New(handler)
io: More efficient ReadAll
io.ReadAll now allocates less intermediate memory and returns a minimally sized slice:
- ~2x faster
- ~50% less memory allocated
- More benefit for larger inputs
reflect: iterators for types and values
New methods that return iterators:
1
2
3
4
// Iterate over struct fields
for field, value := range reflect.ValueOf(myStruct).Fields() {
fmt.Println(field.Name, value)
}
New methods: Type.Fields, Type.Methods, Type.Ins, Type.Outs, Value.Fields, Value.Methods.
net/http: HTTP/2 improvements
- New
HTTP2Config.StrictMaxConcurrentRequestsfield to control opening new connections when the HTTP/2 stream limit is reached Clientnow uses cookies with correct scope for URLs withRequest.Host
testing: artifact directory
New methods T.ArtifactDir, B.ArtifactDir and F.ArtifactDir for writing test output files:
1
go test -artifacts ./...
image/jpeg: faster encoder and decoder
The JPEG encoder and decoder have been replaced with new, faster, more accurate implementations.
Attention: Code that expects specific bit-for-bit outputs may need to be updated.
5. Platform changes
macOS
Go 1.26 is the last release that will run on macOS 12 Monterey. Go 1.27 will require macOS 13 Ventura or later.
Summary:
| Area | Change | Impact |
|---|---|---|
| GC | Green Tea GC by default | 10β40% less overhead |
| Language | new with expressions | Cleaner code |
| Language | Generics self-reference | More powerful constraints |
| Tools | go fix rewritten | Automatic code modernization |
| Runtime | cgo ~30% faster | Better C integration |
| io | ReadAll 2x faster | Less allocations |
| macOS | Last version with macOS 12 | Update to macOS 13+ |
How to update
1
2
3
4
5
6
# Download Go 1.26
go install golang.org/dl/go1.26@latest
go1.26 download
# Or via official site
# https://go.dev/dl/
After updating, run the new go fix to modernize your code:
1
go fix ./...
Conclusion
Go 1.26 is a solid release. The Green Tea GC by default is the most impactful change β youβll notice the difference in applications that make heavy use of memory.
The language changes are small but useful. The rewritten go fix is a long-term bet to keep Go code bases modern.
Worth updating. And as always, Go 1βs compatibility promise guarantees your existing code will continue to work.
References and sources
- Go 1.26 Release Notes - Official release notes
- Go Downloads - Official Go 1.26 download
- Green Tea GC - Green Tea GC tracking issue
- go fix modernizers - Blog posts about the new modernizers
