Go 1.27 is the newest release, but a lot of tutorials, courses and company codebases are still on Go 1.26. It was released on February 10, 2026 (see the release history), and it added a few things you’ll run into quickly. If you’re learning Go, these are worth knowing because you’ll see them in other people’s code.
new() can take a value
The built-in new function used to take only a type. In Go 1.26, according to the release notes, its operand can be an expression that sets the initial value. That sounds small, but it fixes a real annoyance.
Lots of Go code uses a pointer field like *int to mean “this value is optional.” Before 1.26, you couldn’t write &36, so you needed a temporary variable or a little helper function just to get a pointer to a number. Now new(36) does it in one step.
errors.AsType
If you’ve used errors.As, you know you have to declare a variable first and pass a pointer to it. It works, but it confuses a lot of beginners. Go 1.26 adds errors.AsType, which the release notes describe as a generic version of As that is type-safe, faster, and usually easier to use. You tell it the type you’re looking for, and it hands back the error and a bool.
Here are both features together. This runs with go 1.26 (or later) in your go.mod:
package main
import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
)
type Person struct {
Name string `json:"name"`
Age *int `json:"age,omitempty"`
}
func main() {
// Go 1.26: new can take an expression.
p := Person{Name: "Ada", Age: new(36)}
b, _ := json.Marshal(p)
fmt.Println(string(b)) // {"name":"Ada","age":36}
// Go 1.26: errors.AsType, a generic version of errors.As.
_, err := os.Open("missing.txt")
if pathErr, ok := errors.AsType[*fs.PathError](err); ok {
fmt.Println("could not open:", pathErr.Path)
}
}Code language: Go (go)
A faster garbage collector by default
The Green Tea garbage collector, which was an experiment in Go 1.25, is on by default in 1.26. The Go team expects somewhere between a 10 and 40% reduction in garbage collection overhead for programs that lean heavily on the GC. You don’t have to change any code to get this. Just build with the newer toolchain.
go fix got a makeover
The old go fix command was rewritten and is now the home of Go’s “modernizers.” These are fixers that update your code to newer language features and library APIs. For learners, this is a nice way to see what modern Go looks like: run go fix ./... on an old practice project and read the diff.
A few smaller things
go mod initnow writes a slightly oldergoversion into newgo.modfiles. With a 1.26 toolchain you getgo 1.25.0.- The baseline overhead of cgo calls dropped by about 30%.
io.ReadAllis often about twice as fast and allocates less memory.- There’s a new
crypto/hpkepackage and abytes.Buffer.Peekmethod.
One last tip: if you’re still on 1.26, stay on the latest point release. At the time I’m writing this, that’s Go 1.26.10, and it includes an important security fix.