Next Release Notes Draft
DRAFT RELEASE NOTES — Introduction to Go 1.28
Go 1.28 is not yet released. These are work-in-progress release notes. Go 1.28 is expected to be released in February 2027.
Changes to the language
Go 1.28 allows omitting the type of a composite literal whenever its type can be inferred from assignment context. Previously, a composite literal could omit its type only when appearing within an enclosing array, slice, or map literal.
type Point struct{ X, Y float64 }
var origin Point = {} // Point{}
var ptr *Point = {1, 2} // &Point{1, 2}
Starting with Go 1.28, the conversion
of an integer value x to a string type is valid only if x’s underlying type is byte
or rune, or if x is an untyped rune constant.
The ability to convert any integer value to a string type has been removed.
This new restriction lifts a long-existing vet check to the language level.
See issue #3939 for a discussion of this change.
string('a') // "a"
string(97) // invalid: 97 is not a rune constant
Tools
Vet
The new scannererr
analyzer checks for failure to handle scanner errors after a loop
around bufio.Scanner.Scan, which may cause scanning or I/O errors to
go unreported.
The sqlrowserr
analyzer performs a similar check for loops around sql.Rows.Next,
so that iteration errors are correctly distinguished from a smaller result.
Runtime
Memory profile
A new profile type that breaks down total process memory (RSS) is now available.
The new profile type, named memory, is supported in the runtime/pprof package
and as a net/http/pprof endpoint, /debug/pprof/memory.
Go developers are often confused when the operating system reports much more
memory usage than the heap profile shows.
That’s because the existing inuse_space heap profile only shows a sample of
objects that were live at the most recently completed garbage collection.
With the default garbage collection configuration, this is often less than
half of RSS.
The new memory profile is a superset of the inuse_space heap profile that
closes this gap by breaking down RSS into Go and non-Go memory.
Go memory is further split into the heap, stacks, and runtime metadata.
The heap includes the same live object samples as the heap profile, as well
as dead objects the most recently completed garbage collection found
unreachable.
Special thanks to Felix Geisendörfer and Nick Ripley at Datadog for contributing this work.
Compiler
Generic type aliases were introduced in
Go 1.24, but due to an oversight, the compiler and
go/types checked for language version Go 1.23 instead of Go 1.24.
Starting with Go 1.28, declaring a generic type alias requires language
version Go 1.24 or later. Packages targeting Go 1.23 (for instance, via
go 1.23 in go.mod) that declare generic type aliases will now be
rejected unless updated to at least go 1.24.
See issue #83032.
Linker
On macOS and iOS, the linker now supports emitting DWARF debug information
into a separate file in <out>.dSYM/Contents/Resources/DWARF/<out>, instead
of combining it into the output binary.
By default, split DWARF is enabled for -buildmode=c-shared and
-buildmode=plugin, and disabled for executables.
(On macOS, -buildmode=c-shared previously defaulted to -w to omit DWARF;
it now emits split DWARF by default.)
When split DWARF is enabled, go build and go test -c output the .dSYM
directory alongside the built binary, whereas go install does not install
the .dSYM directory.
go clean removes it along with the binary.
The .dSYM directory follows the platform convention used by the C toolchain
and the dsymutil tool.
LLDB understands this convention and will load the debug information automatically
from the split DWARF file.
(Note: LLDB does not understand compressed DWARF, so the binary needs to be
built with the -ldflags=-compressdwarf=0 build option.)
The debug/macho.File.DWARF method is also
updated to load the debug information from the split DWARF file if available.
A linker command line option -splitdwarf can be used to enable or disable
split DWARF.
This option may be removed in a future Go release.
Bootstrap
As mentioned in the Go 1.26 release notes, Go 1.28 now requires Go 1.26.0 or later for bootstrap. We expect that Go 1.30 will require a minor release of Go 1.28.0 or later for bootstrap.
Standard library
Minor changes to the library
crypto/ecdsa
SignASN1, Sign, and PrivateKey.Sign now return an error, and VerifyASN1
and Verify now return false, if the hash is shorter than 16 bytes or longer
than 64 bytes. Such inputs are not the output of a supported hash function, and
suggest a message is being passed instead of its hash, which can be severely
insecure.
crypto/tls
The signature_algorithms_cert extension is no longer sent, because some
middleboxes reject it when it includes ML-DSA. As a result, support for SHA-1
signatures in certificates is no longer advertised by default. The extension
can be re-enabled, without ML-DSA, with the tlssigalgscert=1 GODEBUG option.
Clients now check server certificates against a local
UPKI revocation cache and reject
certificates the cache reports as revoked. For programs targeting Go 1.28
or later, checking is on by default whenever a cache is found, so a
program’s behavior can change when its host
starts running a cache updater such as upki fetch, which some operating
system distributions ship. The cache is looked for in the user cache
directory and then the system cache directory: ~/.cache/upki/revocation
and /var/cache/upki/revocation on Linux and other Unix systems,
~/Library/Caches/dev.rustls.upki/revocation and
/Library/Caches/dev.rustls.upki/revocation on macOS, and
%LocalAppData%\rustls\upki\cache\revocation and
%ProgramData%\rustls\upki\cache\revocation on Windows. Certificates the
cache has no information about, and certificates without embedded Signed
Certificate Timestamps, are accepted. Revocation lookups require a cache
and a certificate chain verified by the TLS client. This includes the ECH
public-name certificate when ECH is rejected and
Config.EncryptedClientHelloRejectionVerify is nil, even when
Config.InsecureSkipVerify is set.
The new Config.UPKIRevocation field, of type UPKIRevocationConfig,
selects a cache directory explicitly, adjusts the policy for inconclusive
checks, or opts out with its Disabled field. Automatic discovery skips
missing or inaccessible cache paths. Applications can set
UPKIRevocationConfig.MissingData to UPKIRevocationPolicyReject to require
an available index for lookups, or to UPKIRevocationPolicyAllow to tolerate
an unavailable index in an explicitly configured cache. A malformed embedded
SCT extension causes verification to fail when a cache is explicitly
configured or found during discovery. A revoked certificate is
reported as a CertificateVerificationError wrapping ErrUPKIRevoked.
The GODEBUG setting tlsupki=0 disables checking with
the platform-default cache. Programs targeting Go 1.27 or earlier use this
setting by default and can opt in with tlsupki=1.
crypto/x509
ParseCertificate, ParseCertificateRequest, ParseRevocationList and
ParsePKIXPublicKey now reject trailing data after the parameters of an
AlgorithmIdentifier, after the RSAPublicKey structure of an RSA public key
and after its public exponent, and after the named curve of an ECDSA public key.
ParseCertificate and ParseCertificateRequest now reject trailing data
after the value of the key usage, basic constraints, subject alternative
name, extended key usage and certificate policies extensions.
Signature algorithm parameters other than NULL or absent for RSA PKCS #1 v1.5, and other than absent for ECDSA, are no longer accepted in certificates, certificate requests, and revocation lists.
debug/macho
If a Mach-O file does not contain DWARF sections, File.DWARF now loads
the debug information from the associated split DWARF file in
<file>.dSYM/Contents/Resources/DWARF/<file> if available.
debug/pe
The ImportDirectory type is now marked as deprecated.
It was exported by accident, is an internal detail of the package,
and should not be used directly.
embed
The ReadAt methods of files returned by embed.FS now return
io.EOF when called with an offset at or beyond the end of the
file, as required by io.ReaderAt.
encoding/base32
Encoding.EncodedLen now panics if the encoded length overflows int,
rather than returning a negative number.
encoding/base64
Encoding.EncodedLen now panics if the encoded length overflows int,
rather than returning a negative number.
flag
The new FlagSet.All method returns an iterator over all the flags in the FlagSet;
the function All does the same for the global CommandLine flag set.
The new Flag.IsSet field indicates whether the flag has been set.
go/analysis
The API of the Go analysis framework, first published in 2019 at
golang.org/x/tools/go/analysis as part of the Go 1.12 reorganization
of cmd/vet, is now part of the standard library.
The new go/analysis package declares the types, such as Analyzer,
Pass, and Diagnostic, that define the interface between analysis
drivers (such as cmd/vet, gopls, and staticcheck), and specific
analyzers (sometimes called checks or linters).
Aside from the package name, the actual API is identical.
go/build
The build.ArchChar function is deprecated, as it no longer varies by architecture.
go/parser
The ResolveFile function performs legacy syntactic identifier
resolution on an ast.File syntax tree. This resolution is
deprecated; new applications should instead use go/types.
This function is provided to ease the transition away from the old
resolution in applications that mostly parse files in
SkipObjectResolution mode but later encounter some cases where the
old resolution is needed.
go/types
The new CommonUnderlying function returns the common underlying type
(if any) of the types in a type set. If its argument is a type
parameter, the result is the single underlying type (if it exists) of
all types in its constraint’s type set; otherwise, the result is the
type’s underlying type. (This is equivalent to the “core type” concept
formerly used in the Go specification.)
The new StrictlyComparable function reports whether values of a given type are strictly comparable.
Added NewTypeList and NewTypeParamList constructors to
create TypeList and TypeParamList instances
from slices of their respective element types.
The new Scope.Objects method returns the sequence of Objects in the Scope.
log/slog
In Go 1.27.1, direct calls to Handler.WithGroup that passed "", including
those inside MultiHandler, would erroneously insert a group with name ""
instead of doing nothing. This bug is now fixed.
maps
The new Grow function increases the capacity of an existing map
so that a known number of additional entries can be added without
repeated incremental growth, for example before a Copy into a map
that cannot be replaced.
math
The new FMA32 function computes x*y + z for float32 values with only one
rounding. It uses a hardware fused multiply-add instruction where available.
net
The IPMask, IPNet, and HardwareAddr types each now implement
a encoding.TextUnmarshaler method. This method will recognize
the current marshaling of those types, as well as a planned future
marshaling format. The future marshaling format will be readable
in JSON format, unlike the current format which is a base64 encoding.
The future marshaling format will become the default in a later Go release.
This is being done as a two-step process so that JSON generated
by this release of Go can still be read by earlier releases of Go.
The unused DNSConfigError type is deprecated.
net/http
The new HTTP2Config.EnableConnectProtocol field enables support for the
Extended CONNECT protocol defined in RFC 8441.
When enabled, HTTP/2 servers advertise support for Extended CONNECT requests.
The new method Server.HandleRequest handles a request as if it was received by the server.
The long-deprecated Transport.CancelRequest now does nothing.
Use NewRequestWithContext (available since Go 1.13)
to create a cancellable request.
ProxyFromEnvironment now prioritizes lowercase proxy environment variables
(http_proxy, https_proxy, and no_proxy) over the uppercase versions if
both are set to different values. This change also affects default proxy lookups
in DefaultTransport and DefaultClient by extension.
The new MethodQuery constant represents the HTTP QUERY method defined in
RFC 10008.
The HTTP/2 server now lets a connection’s serve goroutine exit while the connection has nothing to do, restarting it on demand. This reduces memory usage for servers with many idle connections or many handlers idling mid-response (such as long polls).
Transport uses an entirely rewritten connection pool,
which manages HTTP/1 and HTTP/2 connections in a single pool.
Transport connection limits now consistently apply to all connections:
Transport.MaxIdleConns, Transport.MaxIdleConnsPerHost, and Transport.MaxConnsPerHost
all apply to the combined total of HTTP/1 and HTTP/2 connections.
Previously, these limits were applied inconsistently or not at all to HTTP/2 connections.
Concurrent requests to the same host now coalesce onto a single dial when HTTP/2 is enabled. If HTTP/2 is negotiated, the requests will share the new connection.
net/url
The new MustParse function returns the parsed URL
or panics on error.
It can simplify some common uses of Parse.
For instance, initializing variables with valid URL string constants.
regexp
New Regexp.All, Regexp.AllIndex, Regexp.AllString, Regexp.AllStringIndex,
Regexp.AllStringIndex, Regexp.AllStringSubmatchIndex, Regexp.AllSubmatch, and
Regexp.AllSubmatchIndex iterator methods on Regexp allow incremental matching of the input.
The new Regexp.SplitSeq method iterates over the results of splitting the input with the
regular expression.
simd
The new simd package provides portable, vector-size-agnostic SIMD
types and operations. On architectures supported by simd/archsimd,
the simd package uses multi-compilation and runtime feature detection to
transparently utilize the largest vectors and latest CPU features
supported by the hardware a program is running on, regardless of where
it was compiled. On unsupported architectures, or if hardware vector
acceleration isn’t available, it falls back to emulation.
simd/archsimd
The new simd/archsimd package provides access to architecture-specific
SIMD (single instruction, multiple data) vector types and operations on
amd64, arm64, and wasm.
strconv
When Unquote is applied to a string containing a single-quoted rune
literal, it now correctly returns the rune’s UTF-8 encoding, even when
the literal uses a hexadecimal or octal escape, as in
Unquote(`'\xff'`). (Previously it would return a string whose
sole byte had the same numeric value as the rune, which is incorrect
for non-ASCII.)
sync
The new Counter type is a sharded counter of int64, uint64, or float64
values that is optimized for frequent concurrent calls to Counter.Add and
infrequent calls to Counter.Value. Updates are spread across per-processor
shards, so Add remains fast even when many goroutines update the same counter,
while Value sums the shards and takes time proportional to GOMAXPROCS.
The zero value of a Counter is ready to use.
syscall
On Linux, SysProcAttr now supports enforcement of Landlock policies
and the PR_SET_NO_NEW_PRIVS flag for newly spawned subprocesses.
On Windows, SysProcAttr has several new fields to support additional process
creation features: Jobs ([]Handle) specifies a list of job object handles
to associate with the new process, Console (Handle) specifies a console
handle to connect to the process, Desktop (string) specifies the name of
the desktop on which the process will start, and AppContainer
(*AppContainer) specifies a pointer to a new AppContainer struct to create
the process within an AppContainer using the provided SID and capabilities.
testing/fstest
The ReadAt methods of files returned by testing/fstest.MapFile.Open
now return io.EOF when called with an offset at or beyond the end
of the file, as required by io.ReaderAt.
testing/synctest
The new Subtest convenience function combines [testing.(*T).Run] and testing/synctest.Test.
time
Parse and ParseInLocation now accept a numeric time zone abbreviation
with minutes, such as “+0530”, where the layout has a zone abbreviation
(MST). A numeric abbreviation that the location does not define now gets
the offset it denotes rather than a zero offset. Numeric abbreviations
with three or more than four digits are no longer accepted.
On Windows, the monotonic clock used by Now now has a resolution of
100 nanoseconds. Previously, its resolution was on the order of milliseconds.
This improves the precision of elapsed-time measurements, such as those
made with Since.