Go 1.26: Key Features and Improvements in Q&A
Welcome to the Go 1.26 release—a version packed with language refinements, performance boosts, and developer-friendly tooling updates. In this Q&A, we tackle the most important changes, from the evolved new function and self-referential generics to the default Green Tea garbage collector and experimental SIMD support. Whether you're upgrading your projects or just curious about Go's progress, these detailed answers cover everything you need to know.
What are the major language changes in Go 1.26?
Go 1.26 introduces two significant language refinements. First, the built-in new function now accepts an expression as its operand, allowing you to specify an initial value directly. For example, instead of writing x := int64(300); ptr := &x, you can simply write ptr := new(int64(300)). This simplifies variable creation and initialization. Second, generic types can now refer to themselves within their type parameter list. This self-referential capability makes it easier to implement complex data structures like recursive trees or graph nodes and improves the expressiveness of generic interfaces. Both changes are backward-compatible, so existing code continues to work unchanged.

How does the new new function work with expressions?
The longstanding new(T) function has been upgraded to new(expr), where expr is any expression that yields a value of a pointer type. The function allocates memory for that value and returns a pointer to it. For instance, new(int64(300)) creates an int64 variable initialized to 300 and returns a pointer. This eliminates the need for a separate variable declaration and address-of operation. Under the hood, the compiler still allocates the value on the heap or stack as appropriate. This change is especially handy for struct literals: ptr := new(MyStruct{Field: 42}). It reduces boilerplate and makes intent clearer.
What is the significance of self-referential generic types?
Self-referential generic types allow a type to reference itself within its own type parameter list. For example, a generic Node type can be defined as type Node[T any] struct { value T; children []Node[T] } without needing a separate interface or wrapper. This is particularly useful for recursive data structures like trees, linked lists, or graph nodes where the contained type is the same as the container. It also simplifies implementing interfaces like Comparable that require self-referencing constraints. Previously, such patterns required workarounds like embedding or additional type parameters. This improvement makes generic code more natural and less cluttered.
What performance improvements does Go 1.26 bring?
Go 1.26 delivers three key performance enhancements. First, the Green Tea garbage collector (previously experimental) is now enabled by default. It reduces tail latency and improves memory throughput, especially under high allocation rates. Second, the baseline cgo overhead has been reduced by approximately 30%, making calls from Go to C significantly cheaper. This is great for projects that rely on C libraries. Third, the compiler can now allocate slice backing stores on the stack in more situations, avoiding heap allocations and reducing pressure on the garbage collector. These improvements together make Go more efficient for both CPU-bound and I/O-bound workloads.
How has the go fix command been improved?
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 fixes to help your code take advantage of newer language features and standard library improvements. For example, it can automatically replace old patterns with newer equivalents, like using errors.Join instead of manual concatenation. Additionally, go fix now supports the inline analyzer: by annotating a function with //go:fix inline, the tool will attempt to inline all calls to that function across your project. This makes it easier to optimize hot paths without manual inlining. Future blog posts will dive deeper into these capabilities.
What new packages are introduced in Go 1.26?
Three new packages join the standard library. crypto/hpke implements the Hybrid Public Key Encryption (HPKE) standard (RFC 9180), enabling efficient encryption for protocols like TLS and Messaging Layer Security. crypto/mlkem/mlkemtest provides test vectors for the ML-KEM (formerly Kyber) post-quantum key encapsulation mechanism, helping developers verify their implementations. testing/cryptotest offers utilities for writing cryptographic tests, including random data generation and property-based testing helpers. These packages expand Go's cryptographic capabilities and make it easier to build secure systems.
What experimental features are available in Go 1.26?
Go 1.26 includes three experimental features that require explicit opt-in. simd/archsimd provides access to single-instruction, multiple-data (SIMD) operations for vectorized computations, boosting performance in numerical and multimedia processing. runtime/secret offers secure memory erasure for temporary cryptographic secrets, preventing them from being leaked through memory dumps or garbage collection. runtime/pprof now supports a goroutineleak profile that reports leaked goroutines—those that are stuck or never finish—helping detect resource leaks. These experiments are expected to become generally available in future Go versions. The Go team encourages developers to try them and provide feedback.
For the complete list of changes, see the Go 1.26 Release Notes. Stay tuned for follow-up blog posts covering these features in depth.
Related Discussions