What's New in Go 1.26? A Comprehensive Q&A

By • min read

Go 1.26 has officially landed, bringing a host of exciting features, performance improvements, and tooling enhancements. This Q&A covers everything you need to know — from language tweaks to experimental packages. Whether you’re a seasoned Gopher or just getting started, read on to see what’s new.

What language changes does Go 1.26 introduce?

Go 1.26 refines the language syntax and type system with two key changes. First, the built-in new function now accepts an expression as its operand, allowing you to specify an initial value. For example, instead of writing x := int64(300); ptr := &x, you can simply write ptr := new(int64(300)). This simplifies common patterns where you need a pointer to a value.

What's New in Go 1.26? A Comprehensive Q&A
Source: blog.golang.org

Second, generic types can now refer to themselves in their own type parameter list. This self-referential generics feature makes it easier to implement recursive data structures like trees or linked lists directly within generic type definitions. Both changes are backward-compatible, so existing code continues to work without modification.

How do self-referential generics work in Go 1.26?

Previously, a generic type like type Node[T any] struct { next *Node[T] } was possible, but you couldn’t reference the type itself inside its own type parameter constraints. In Go 1.26, the type checker now allows a generic type to appear in its own type parameter list when defining recursive constraints. For instance, you can now write an interface that requires its implementor to be comparable with itself, which is essential for container types like sets or ordered trees.

This change removes a long-standing limitation and opens the door for more expressive and type-safe generic APIs. The Go team has ensured the implementation fits seamlessly with the existing generics design, so no breaking changes were introduced.

What performance improvements come with Go 1.26?

Go 1.26 brings several important performance boosts. The previously experimental Green Tea garbage collector is now enabled by default, offering lower latency and better memory management for most workloads. The baseline cgo overhead has been reduced by approximately 30%, which speeds up programs that call C code. Additionally, the compiler can now allocate the backing store for slices on the stack in more situations, reducing heap allocations and improving overall execution time.

These improvements are particularly beneficial for high-throughput servers and latency-sensitive applications. Benchmarks show noticeable gains in both CPU and memory usage.

How has the go fix command changed in Go 1.26?

The go fix command has been completely rewritten to leverage the Go analysis framework. It now includes a couple dozen “modernizers”—analyzers that suggest safe, automatic fixes to help your code take advantage of newer language features and standard library improvements. For example, it can convert older interface{} uses to any or update deprecated function calls.

Another addition is the inline analyzer. By annotating a function with //go:fix inline, you instruct go fix to attempt inlining all calls to that function. This helps optimize performance-critical code paths. Two upcoming blog posts will dive deeper into these tooling features. Run go fix -diff ./... to preview changes before applying them.

Which new packages are included in Go 1.26?

Three new packages join the standard library in Go 1.26:

These packages fill important gaps in Go’s cryptographic capabilities and support the ongoing transition to quantum-resistant algorithms.

What experimental features are available in Go 1.26?

Go 1.26 introduces several experimental features that you can opt into. These include:

All three are expected to become generally available in a future Go release. Try them out and share your feedback to help shape their final design.

How can I download and start using Go 1.26?

Binary archives and installers for Go 1.26 are available on the official download page. The release includes updated tools for all supported platforms (Windows, macOS, Linux, etc.). After downloading and installing, you can verify the version with go version.

For a complete list of changes, refer to the Go 1.26 Release Notes. Over the coming weeks, the Go blog will publish follow-up posts covering specific topics in more detail. As always, the Go team thanks everyone who contributed code, bug reports, and feedback to this release.

Recommended

Discover More

6 Essential Things You Need to Know About LLMs and Interaction Detection at Scale10 Essential Strategies for Conquering Scope 3 EmissionsJackRabbit MG Cargo: The Featherweight Hauler That Defies ExpectationsFamily Reunion: A Chaotic Time-Attack Adventure Through a Child's Eyes at the Dinner TablePython Ships Urgent Release Pair: 3.14.2 and 3.13.11 Fix Regressions and Security Flaws