Next Release Notes Draft
DRAFT RELEASE NOTES — Introduction to Go 1.26
Go 1.26 is not yet released. These are work-in-progress release notes. Go 1.26 is expected to be released in February 2026.
Changes to the language
The built-in new function, which creates a new variable, now allows
its operand to be an expression, specifying the initial value of the
variable.
This feature is particularly useful when working with serialization
packages such as encoding/json or protocol buffers that use a
pointer to represent an optional value, as it enables an optional
field to be populated in a simple expression, for example:
import "encoding/json"
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)),
})
}
func yearsSince(t time.Time) int {
return int(time.Since(t).Hours() / (365.25 * 24)) // approximately
}
Tools
Go command
cmd/doc, and go tool doc have been deleted. go doc can be used as
a replacement for go tool doc: it takes the same flags and arguments and
has the same behavior.
The go fix command, following the pattern of go vet in Go 1.10,
now uses the Go analysis framework (golang.org/x/tools/go/analysis).
This means the same analyzers that provide diagnostics in go vet
can be used to suggest and apply fixes in go fix.
The go fix command’s historical fixers, all of which were obsolete,
have been removed and replaced by a suite of new analyzers that
offer fixes to use newer features of the language and library.
Bootstrap
As mentioned in the Go 1.24 release notes, Go 1.26 now requires Go 1.24.6 or later for bootstrap. We expect that Go 1.28 will require a minor release of Go 1.26 or later for bootstrap.
Standard library
Minor changes to the library
go/types
The Var.Kind method returns an enumeration of type VarKind that
classifies the variable (package-level, local, receiver, parameter,
result, or struct field). See issue #70250.
Callers of NewVar or NewParam are encouraged to call Var.SetKind
to ensure that this attribute is set correctly in all cases.
crypto/ecdsa
The big.Int fields of PublicKey and PrivateKey are now deprecated.
crypto/rsa
If PrivateKey fields are modified after calling PrivateKey.Precompute,
PrivateKey.Validate now fails.
PrivateKey.D is now checked for consistency with precomputed values, even if
it is not used.
database/sql/driver
A database driver may implement RowsColumnScanner to entirely override Scan behavior.
errors
The new AsType function is a generic version of As. It is type-safe, faster,
and, in most cases, easier to use.
go/ast
The new ParseDirective function parses directive
comments, which are comments such as //go:generate.
Source code tools can support their own directive comments and this new API
should help them implement the conventional syntax.
image/jpeg
The JPEG encoder and decoder have been replaced with new, faster, more accurate implementations. Code that expects specific bit-for-bit outputs from the encoder or decoder may need to be updated.
log/slog
The NewMultiHandler function creates a
MultiHandler that invokes all the given Handlers.
Its Enable method reports whether any of the handlers’ Enabled methods
return true.
Its Handle, WithAttr and WithGroup methods call the corresponding method
on each of the enabled handlers.
net
Added context aware dial functions for TCP, UDP, IP and Unix networks.
net/http
The new HTTP2Config.StrictMaxConcurrentRequests field controls whether a new connection should be opened if an existing HTTP/2 connection has exceeded its stream limit.
net/http/httptest
The HTTP client returned by Server.Client will now redirect requests for
example.com and any subdomains to the server being tested.
net/http/httputil
The ReverseProxy.Director configuration field is deprecated
in favor of ReverseProxy.Rewrite.
A malicious client can remove headers added by a Director function
by designating those headers as hop-by-hop. Since there is no way to address
this problem within the scope of the Director API, we added a new
Rewrite hook in Go 1.20. Rewrite hooks are provided with both the
unmodified inbound request received by the proxy and the outbound request
which will be sent by the proxy.
Since the Director hook is fundamentally unsafe, we are now deprecating it.
net/netip
The new Prefix.Compare method compares two prefixes.
os
The new Process.WithHandle method provides access to an internal process
handle on supported platforms (Linux 5.4 or later and Windows). On Linux,
the process handle is a pidfd. The method returns ErrNoHandle on unsupported
platforms or when no process handle is available.
On Windows, the OpenFile flag parameter can now contain any combination of
Windows-specific file flags, such as FILE_FLAG_OVERLAPPED and
FILE_FLAG_SEQUENTIAL_SCAN, for control of file or device caching behavior,
access modes, and other special-purpose flags.
testing
The new methods T.ArtifactDir, B.ArtifactDir, and F.ArtifactDir
return a directory in which to write test output files (artifacts).
When the -artifacts flag is provided to go test,
this directory will be located under the output directory
(specified with -outputdir, or the current directory by default).
Otherwise, artifacts are stored in a temporary directory
which is removed after the test completes.
The first call to ArtifactDir when -artifacts is provided
writes the location of the directory to the test log.
For example, in a test named TestArtifacts,
t.ArtifactDir() emits:
=== ARTIFACTS Test /path/to/artifact/dir
Ports
Windows
As announced in the Go 1.25 release notes, the broken 32-bit windows/arm port (GOOS=windows GOARCH=arm) is removed.