2023-07-18 14:55:13 -06:00
<!-- {
"Title": "Go 1.22 Release Notes",
"Path": "/doc/go1.22"
}-->
<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
< code > hello< / code > < code > world< / code > .
Do not send CLs removing the interior tags from such phrases.
-->
< style >
main ul li { margin: 0.5em 0; }
< / style >
< h2 id = "introduction" > DRAFT RELEASE NOTES — Introduction to Go 1.22< / h2 >
< p >
< strong >
Go 1.22 is not yet released. These are work-in-progress
release notes. Go 1.22 is expected to be released in February 2024.
< / strong >
< / p >
< h2 id = "language" > Changes to the language< / h2 >
< p >
TODO: complete this section
< / p >
< h2 id = "tools" > Tools< / h2 >
< h3 id = "go-command" > Go command< / h3 >
2023-11-22 13:37:13 -07:00
<!-- https://go.dev/issue/60056 -->
2023-07-18 14:55:13 -06:00
< p >
2023-11-22 13:37:13 -07:00
<!-- support vendoring in workspace mode -->
< / p >
<!-- CL 518775 -->
< p >
<!-- cmd/go: delete GOPATH - mode get -->
< / p >
<!-- https://go.dev/issue/60915 -->
< p >
<!-- preserve basic GOPATH mode indefinitely -->
< / p >
<!-- CL 518776 -->
< p >
<!-- cmd/go: remove conversion of legacy pre - module dependency configs -->
2023-07-18 14:55:13 -06:00
< / p >
2023-08-25 17:41:17 -06:00
< h3 id = "cgo" > Cgo< / h3 >
2023-11-22 13:37:13 -07:00
<!-- https://go.dev/issue/56378 -->
< p >
<!-- add #cgo noescape/nocallback annotations -->
< / p >
2023-11-30 12:11:58 -07:00
< h3 id = "trace" > Trace< / h3 >
<!-- https://go.dev/issue/63960 -->
< p >
The < code > trace< / code > tool's web UI has been gently refreshed as part of the
work to support the new tracer, resolving several issues and improving the
readability of various sub-pages.
The web UI now supports exploring traces in a thread-oriented view.
The trace viewer also now displays the full duration of all system calls.
< br / >
These improvements only apply for viewing traces produced by programs built with
Go 1.22 or newer.
A future release will bring some of these improvements to traces produced by older
version of Go.
< / p >
2023-11-22 13:37:13 -07:00
< h3 id = "vet" > Vet< / h3 >
< p > <!-- CL 539016 -->
TODO: < a href = "https://go.dev/cl/539016" > https://go.dev/cl/539016< / a > : go/analysis/passes/loopclosure: disable checker after go1.22.; loopclosure was modified to only not report in files with GoVersion after 1.22.
< / p >
<!-- CL 527095 -->
< p >
<!-- cmd/vet: add defers analysis pass; Add a release note that there is a new defers checker in cmd/vet. -->
< / p >
<!-- https://go.dev/issue/60048 -->
< p >
<!-- time.Since should not be used in defer statement -->
< / p >
<!-- https://go.dev/issue/60448 -->
< p >
<!-- add a new analyzer for check missing values after append -->
< / p >
2023-08-25 17:41:17 -06:00
2023-07-18 14:55:13 -06:00
< h2 id = "runtime" > Runtime< / h2 >
2023-11-30 12:36:46 -07:00
< p > <!-- CL 543255 -->
The runtime now keeps type-based garbage collection metadata nearer to each
heap object, improving the CPU performance (latency or throughput) of Go programs
by 1— 3%.
This change also reduces the memory overhead of the majority Go programs by
approximately 1% by deduplicating redundant metadata.
Some programs may see a smaller improvement because this change adjusts the size
class boundaries of the memory allocator, so some objects may be moved up a size
class.
< br / >
A consequence of this change is that some objects' addresses that were previously
always aligned to a 16 byte (or higher) boundary will now only be aligned to an 8
byte boundary.
Some programs that use assembly instructions that require memory addresses to be
more than 8-byte aligned and rely on the memory allocator's previous alignment behavior
may break, but we expect such programs to be rare.
Such programs may be built with < code > GOEXPERIMENT=noallocheaders< / code > to revert
to the old metadata layout and restore the previous alignment behavior, but package
owners should update their assembly code to avoid the alignment assumption, as this
workaround will be removed in a future release.
2023-07-18 14:55:13 -06:00
< / p >
< h2 id = "compiler" > Compiler< / h2 >
< p >
2023-12-04 11:31:21 -07:00
TODO: complete this section.
< / p >
< p > <!-- https://go.dev/issue/61577 -->
< a href = "https://go.dev/doc/pgo" > Profile-guided Optimization (PGO)< / a > builds
can now devirtualize a higher proportion of calls than previously possible.
Most programs from a representative set of Go programs now see between 2 and
14% improvement from enabling PGO.
2023-07-18 14:55:13 -06:00
< / p >
< h2 id = "linker" > Linker< / h2 >
2023-11-22 13:37:13 -07:00
< p > <!-- https://go.dev/issue/62577 -->
TODO: < a href = "https://go.dev/issue/62577" > https://go.dev/issue/62577< / a > : cmd/link, cmd/go: emit split DWARF on darwin
< / p >
2023-07-18 14:55:13 -06:00
< p >
TODO: complete this section, or delete if not needed
< / p >
2023-11-30 14:02:24 -07:00
< h2 id = "bootstrap" > Bootstrap< / h2 >
< p >
As mentioned in the < a href = "/doc/go1.20#bootstrap" > Go 1.20 release notes< / a > , Go 1.22 now requires
the final point release of Go 1.20 or later for bootstrap.
We expect that Go 1.24 will require the final point release of Go 1.22 or later for bootstrap.
< / p >
2023-07-18 14:55:13 -06:00
< h2 id = "library" > Core library< / h2 >
2023-11-22 13:37:13 -07:00
< h3 id = "minor_library_changes" > New math/rand/v2 package< / h3 >
< p > <!-- CL 502495 -->
TODO: < a href = "https://go.dev/cl/502495" > https://go.dev/cl/502495< / a > : math/rand/v2: start of new API; modified api/next/61716.txt
< / p >
< p > <!-- CL 502497 -->
TODO: < a href = "https://go.dev/cl/502497" > https://go.dev/cl/502497< / a > : math/rand/v2: remove Read; modified api/next/61716.txt
< / p >
< p > <!-- CL 502498 -->
TODO: < a href = "https://go.dev/cl/502498" > https://go.dev/cl/502498< / a > : math/rand/v2: remove Rand.Seed; modified api/next/61716.txt
< / p >
< p > <!-- CL 502499 -->
TODO: < a href = "https://go.dev/cl/502499" > https://go.dev/cl/502499< / a > : math/rand/v2: change Source to use uint64; modified api/next/61716.txt
< / p >
< p > <!-- CL 502500 -->
TODO: < a href = "https://go.dev/cl/502500" > https://go.dev/cl/502500< / a > : math/rand/v2: add, optimize N, UintN, Uint32N, Uint64N; modified api/next/61716.txt
< / p >
< p > <!-- CL 502505 -->
TODO: < a href = "https://go.dev/cl/502505" > https://go.dev/cl/502505< / a > : math/rand/v2: add PCG-DXSM; modified api/next/61716.txt
< / p >
< p > <!-- CL 502506 -->
TODO: < a href = "https://go.dev/cl/502506" > https://go.dev/cl/502506< / a > : math/rand/v2: delete Mitchell/Reeds source; modified api/next/61716.txt
< / p >
< p > <!-- CL 516857 -->
TODO: < a href = "https://go.dev/cl/516857" > https://go.dev/cl/516857< / a > : math/rand/v2: rename various functions; modified api/next/61716.txt
< / p >
< p > <!-- CL 516859 -->
TODO: < a href = "https://go.dev/cl/516859" > https://go.dev/cl/516859< / a > : math/rand/v2: add ChaCha8; modified api/next/61716.txt
< / p >
2023-07-18 14:55:13 -06:00
< h3 id = "minor_library_changes" > Minor changes to the library< / h3 >
< p >
As always, there are various minor changes and updates to the library,
made with the Go 1 < a href = "/doc/go1compat" > promise of compatibility< / a >
in mind.
There are also various performance improvements, not enumerated here.
< / p >
< p >
TODO: complete this section
< / p >
2023-11-22 13:37:13 -07:00
< dl id = "archive/tar" > < dt > < a href = "/pkg/archive/tar/" > archive/tar< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/50102 -->
TODO: < a href = "https://go.dev/issue/50102" > https://go.dev/issue/50102< / a > : add FileInfoNames interface
< / p >
< p > <!-- https://go.dev/issue/58000 -->
TODO: < a href = "https://go.dev/issue/58000" > https://go.dev/issue/58000< / a > : add (*Writer).AddFS
< / p >
< p > <!-- CL 513316 -->
TODO: < a href = "https://go.dev/cl/513316" > https://go.dev/cl/513316< / a > : archive/tar: add AddFS method to Writer; modified api/next/58000.txt
< / p >
< p > <!-- CL 514235 -->
TODO: < a href = "https://go.dev/cl/514235" > https://go.dev/cl/514235< / a > : archive/tar: add FileInfoNames interface; modified api/next/50102.txt
< / p >
< / dd >
< / dl > <!-- archive/tar -->
< dl id = "bufio" > < dt > < a href = "/pkg/bufio/" > bufio< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/56381 -->
TODO: < a href = "https://go.dev/issue/56381" > https://go.dev/issue/56381< / a > : allow terminating Scanner early cleanly without a final token or an error
< / p >
< / dd >
< / dl > <!-- bufio -->
< dl id = "cmd" > < dt > < a href = "/pkg/cmd/" > cmd< / a > < / dt >
< dd >
< p > <!-- CL 498416 -->
TODO: < a href = "https://go.dev/cl/498416" > https://go.dev/cl/498416< / a > : cmd: add a new analyzer for check missing values after append
< / p >
< / dd >
< / dl > <!-- cmd -->
< dl id = "cmp" > < dt > < a href = "/pkg/cmp/" > cmp< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/60204 -->
TODO: < a href = "https://go.dev/issue/60204" > https://go.dev/issue/60204< / a > : add Or
< / p >
< p > <!-- CL 504883 -->
TODO: < a href = "https://go.dev/cl/504883" > https://go.dev/cl/504883< / a > : cmp: add Or; modified api/next/60204.txt
< / p >
< / dd >
< / dl > <!-- cmp -->
< dl id = "crypto/tls" > < dt > < a href = "/pkg/crypto/tls/" > crypto/tls< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/43922 -->
TODO: < a href = "https://go.dev/issue/43922" > https://go.dev/issue/43922< / a > : implement RFC7627
< / p >
< p > <!-- https://go.dev/issue/60107 -->
TODO: < a href = "https://go.dev/issue/60107" > https://go.dev/issue/60107< / a > : QUIC 0-RTT APIs
< / p >
< p > <!-- https://go.dev/issue/62459 -->
TODO: < a href = "https://go.dev/issue/62459" > https://go.dev/issue/62459< / a > : make default minimum version for servers TLS 1.2
< / p >
< p > <!-- https://go.dev/issue/63413 -->
TODO: < a href = "https://go.dev/issue/63413" > https://go.dev/issue/63413< / a > : disable RSA key exchange cipher suites by default
< / p >
< p > <!-- CL 514997 -->
TODO: < a href = "https://go.dev/cl/514997" > https://go.dev/cl/514997< / a > : crypto/tls: change SendSessionTicket to take an options struct; modified api/go1.21.txt
< / p >
< p > <!-- CL 541516 -->
TODO: < a href = "https://go.dev/cl/541516" > https://go.dev/cl/541516< / a > : crypto/tls: change default minimum version to 1.2
< / p >
< p > <!-- CL 541517 -->
TODO: < a href = "https://go.dev/cl/541517" > https://go.dev/cl/541517< / a > : crypto/tls: remove RSA KEX ciphers from the default list
< / p >
< p > <!-- CL 544155 -->
TODO: < a href = "https://go.dev/cl/544155" > https://go.dev/cl/544155< / a > : crypto/tls: disable ExportKeyingMaterial without EMS
< / p >
< / dd >
< / dl > <!-- crypto/tls -->
< dl id = "crypto/x509" > < dt > < a href = "/pkg/crypto/x509/" > crypto/x509< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/57178 -->
TODO: < a href = "https://go.dev/issue/57178" > https://go.dev/issue/57178< / a > : support code-constrained roots
< / p >
< p > <!-- https://go.dev/issue/58922 -->
TODO: < a href = "https://go.dev/issue/58922" > https://go.dev/issue/58922< / a > : add android user trusted CA folder as a possible source for certificate retrieval
< / p >
< p > <!-- https://go.dev/issue/60665 -->
TODO: < a href = "https://go.dev/issue/60665" > https://go.dev/issue/60665< / a > : introduce new robust OID type & use it for certificate policies
< / p >
< p > <!-- CL 519315 -->
TODO: < a href = "https://go.dev/cl/519315" > https://go.dev/cl/519315< / a > : crypto/x509: implement AddCertWithConstraint; modified api/next/57178.txt
< / p >
< p > <!-- CL 520535 -->
TODO: < a href = "https://go.dev/cl/520535" > https://go.dev/cl/520535< / a > : crypto/x509: add new OID type and use it in Certificate; modified api/next/60665.txt
< / p >
< / dd >
< / dl > <!-- crypto/x509 -->
2023-08-14 22:33:37 -06:00
< dl id = "database/sql" > < dt > < a href = "/pkg/database/sql/" > database/sql< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/60370, CL 501700 -->
The new < a href = "/pkg/database/sql/#Null" > < code > Null[T]< / code > < / a > type
provide a way to scan nullable columns for any column types.
< / p >
< / dd >
2023-11-22 13:37:13 -07:00
< / dl > <!-- database/sql -->
< dl id = "encoding" > < dt > < a href = "/pkg/encoding/" > encoding< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/53693 -->
TODO: < a href = "https://go.dev/issue/53693" > https://go.dev/issue/53693< / a > : provide append-like variants
< / p >
< p > <!-- CL 504884 -->
TODO: < a href = "https://go.dev/cl/504884" > https://go.dev/cl/504884< / a > : encoding: add AppendEncode and AppendDecode; modified api/next/53693.txt
< / p >
< p > <!-- CL 505236 -->
TODO: < a href = "https://go.dev/cl/505236" > https://go.dev/cl/505236< / a > : encoding: reject negative runes in Encoding.WithPadding; Providing a negative rune to Encoding.WithPadding other than NoPadding made no semantic sense, and will now panic.
< / p >
< / dd >
< / dl > <!-- encoding -->
< dl id = "go/ast" > < dt > < a href = "/pkg/go/ast/" > go/ast< / a > < / dt >
< dd >
2023-12-05 13:16:18 -07:00
< p > <!-- https://go.dev/issue/52463, https://go/dev/cl/504915 -->
The following declarations related to
< a href = 'https://pkg.go.dev/go/ast#Object' > syntactic identifier resolution< / a >
are now < a href = "https://go.dev/issue/52463" > deprecated< / a > :
< code > Ident.Obj< / code > ,
< code > Object< / code > ,
< code > Scope< / code > ,
< code > File.Scope< / code > ,
< code > File.Unresolved< / code > ,
< code > Importer< / code > ,
< code > Package< / code > ,
< code > NewPackage< / code > .
2023-11-22 13:37:13 -07:00
< / p >
2023-12-05 13:16:18 -07:00
< p >
Identifiers cannot be accurately resolved without type information.
Consider, for example, the identifier < code > K< / code >
in < code > T{K: ""}< / code > : it could be the name of a local variable
if T is a map type, or the name of a field if T is a struct type.
< / p >
< p >
New programs should use the < a href = '/pkg/go/types' > go/types< / a >
package to resolve identifiers;
see < code > Object< / code > , < code > Info.Uses< / code > ,
and < code > Info.Defs< / code > for details.
2023-11-22 13:37:13 -07:00
< / p >
< / dd >
< / dl > <!-- go/ast -->
< dl id = "go/version" > < dt > < a href = "/pkg/go/version/" > go/version< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/62039 -->
TODO: < a href = "https://go.dev/issue/62039" > https://go.dev/issue/62039< / a > : package for handling Go version strings
< / p >
< p > <!-- CL 538895 -->
TODO: < a href = "https://go.dev/cl/538895" > https://go.dev/cl/538895< / a > : go/version: add new package; modified api/next/62039.txt
< / p >
< / dd >
< / dl > <!-- go/version -->
< dl id = "html/template" > < dt > < a href = "/pkg/html/template/" > html/template< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61619 -->
TODO: < a href = "https://go.dev/issue/61619" > https://go.dev/issue/61619< / a > : allow actions in JS template literals
< / p >
< p > <!-- CL 507995 -->
TODO: < a href = "https://go.dev/cl/507995" > https://go.dev/cl/507995< / a > : html/template: support parsing complex JS template literals; modified api/next/61619.txt
< / p >
< / dd >
< / dl > <!-- html/template -->
< dl id = "io" > < dt > < a href = "/pkg/io/" > io< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61870 -->
TODO: < a href = "https://go.dev/issue/61870" > https://go.dev/issue/61870< / a > : add SectionReader.Outer method
< / p >
< p > <!-- CL 526855 -->
TODO: < a href = "https://go.dev/cl/526855" > https://go.dev/cl/526855< / a > : io: add (*SectionReader).Outer(); modified api/next/61870.txt
< / p >
< / dd >
< / dl > <!-- io -->
< dl id = "log/slog" > < dt > < a href = "/pkg/log/slog/" > log/slog< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/62418 -->
TODO: < a href = "https://go.dev/issue/62418" > https://go.dev/issue/62418< / a > : enable setting level on default log.Logger
< / p >
< p > <!-- CL 525096 -->
TODO: < a href = "https://go.dev/cl/525096" > https://go.dev/cl/525096< / a > : log/slog: add LogLoggerLevel to enable setting level on the default logger; modified api/next/62418.txt
< / p >
< / dd >
< / dl > <!-- log/slog -->
< dl id = "math/big" > < dt > < a href = "/pkg/math/big/" > math/big< / a > < / dt >
< dd >
2023-12-04 11:45:50 -07:00
< p > <!-- https://go.dev/issue/50489, CL 539299 -->
The new method < a href = "/pkg/math/big#Rat.FloatPrec" > Rat.FloatPrec< / a > computes the number of fractional decimal digits
required to represent a rational number accurately as a floating-point number, and whether accurate decimal representation
is possible in the first place.
2023-11-22 13:37:13 -07:00
< / p >
< / dd >
< / dl > <!-- math/big -->
< dl id = "net" > < dt > < a href = "/pkg/net/" > net< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/58808 -->
TODO: < a href = "https://go.dev/issue/58808" > https://go.dev/issue/58808< / a > : arrange zero-copy of os.File and TCPConn to UnixConn
< / p >
< p > <!-- CL 467335 -->
TODO: < a href = "https://go.dev/cl/467335" > https://go.dev/cl/467335< / a > : net: respect hosts file when resolving names for Windows
< / p >
< / dd >
< / dl > <!-- net -->
< dl id = "net/http" > < dt > < a href = "/pkg/net/http/" > net/http< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/51971 -->
TODO: < a href = "https://go.dev/issue/51971" > https://go.dev/issue/51971< / a > : add ServeFileFS, FileServerFS, NewFileTransportFS
< / p >
< p > <!-- https://go.dev/issue/61410 -->
TODO: < a href = "https://go.dev/issue/61410" > https://go.dev/issue/61410< / a > : enhanced ServeMux routing
< / p >
< p > <!-- CL 513956 -->
TODO: < a href = "https://go.dev/cl/513956" > https://go.dev/cl/513956< / a > : net/http: add ServeFileFS, FileServerFS, NewFileTransportFS; modified api/next/51971.txt
< / p >
< p > <!-- CL 517336 -->
TODO: < a href = "https://go.dev/cl/517336" > https://go.dev/cl/517336< / a > : net/http: disallow empty Content-Length header
< / p >
< p > <!-- CL 528355 -->
TODO: < a href = "https://go.dev/cl/528355" > https://go.dev/cl/528355< / a > : net/http: implement path value methods on Request; modified api/next/61410.txt
< / p >
< / dd >
< / dl > <!-- net/http -->
< dl id = "net/http/cgi" > < dt > < a href = "/pkg/net/http/cgi/" > net/http/cgi< / a > < / dt >
< dd >
< p > <!-- CL 539615 -->
TODO: < a href = "https://go.dev/cl/539615" > https://go.dev/cl/539615< / a > : net/http/cgi: the PATH_INFO should be empty or start with a slash
< / p >
< / dd >
< / dl > <!-- net/http/cgi -->
< dl id = "net/netip" > < dt > < a href = "/pkg/net/netip/" > net/netip< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61642 -->
TODO: < a href = "https://go.dev/issue/61642" > https://go.dev/issue/61642< / a > : add Prefix.Compare and AddrPort.Compare
< / p >
< p > <!-- CL 524616 -->
TODO: < a href = "https://go.dev/cl/524616" > https://go.dev/cl/524616< / a > : net/netip: add AddrPort.Compare and Prefix.Compare; modified api/next/61642.txt
< / p >
< / dd >
< / dl > <!-- net/netip -->
< dl id = "os" > < dt > < a href = "/pkg/os/" > os< / a > < / dt >
< dd >
< p > <!-- CL 516555 -->
TODO: < a href = "https://go.dev/cl/516555" > https://go.dev/cl/516555< / a > : os: follow all name surrogate reparse points in Stat on Windows
< / p >
< p > <!-- https://go.dev/issue/58808 -->
TODO: < a href = "https://go.dev/issue/58808" > https://go.dev/issue/58808< / a > : arrange zero-copy of os.File and TCPConn to UnixConn
< / p >
< / dd >
< / dl > <!-- os -->
< dl id = "os/exec" > < dt > < a href = "/pkg/os/exec/" > os/exec< / a > < / dt >
< dd >
< p > <!-- CL 528037 -->
TODO: < a href = "https://go.dev/cl/528037" > https://go.dev/cl/528037< / a > : os/exec: fix edge cases in Windows PATH resolution
< / p >
< p > <!-- CL 528038 -->
TODO: < a href = "https://go.dev/cl/528038" > https://go.dev/cl/528038< / a > : os/exec: avoid calling LookPath in cmd.Start for resolved paths
< / p >
< / dd >
< / dl > <!-- os/exec -->
2023-08-14 22:33:37 -06:00
go/types: set correct Var.scopePos for parameters/results
Previously, its value was unset (NoPos), but the correct
value is a point after the signature (FuncType.End) and
before the body.
Also, fix a bug in Scope.Innermost whereby it would return
the wrong (outer) scope when the query position was in
the FuncType portion of a Func{Decl,Lit}.
The fix is to set the scope's pos/end to those of the
complete Func{Decl,Lit}. This is now documented at
Info.Scopes, along with other missing information.
Also, fix a bug in the go/types (but not types2) scope
test, in which comments were discarded by the parser,
causing the entire test to be a no-op (!).
Also, make failures of TestScopeLookupParent more
informative.
Also, add a release note about the change in behavior.
Fixes #64292
Fixes #64295
Change-Id: Ib681f59d1b0b43de977666db08302d7524d3305f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544035
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2023-11-20 15:22:37 -07:00
< dl id = "go/types" > < dt > < a href = "/pkg/go/types/" > go/types< / a > < / dt >
< dd >
2023-12-04 13:35:35 -07:00
< p > <!-- https://go.dev/issue/62037, CL 541575 -->
The new helper method < a href = "/pkg/go/types#Info.PkgNameOf" > < code > PkgNameOf< / code > < / a > returns the local package name
for the given import declaration.
2023-12-04 12:13:32 -07:00
< / p >
2023-12-04 14:24:13 -07:00
< p > <!-- https://go.dev/issue/63223, CL 521956, CL 541737 -->
The new < a href = "/pkg/go/types#Alias" > < code > Alias< / code > < / a > type represents type aliases.
Previously, type aliases were not represented explicitly, so a reference to a type alias was equivalent
to spelling out the aliased type, and the name of the alias was lost.
The new representation retains the intermediate Alias.
This enables improved error reporting (the name of an alias can be reported), and allows for better handling
of cyclic type declarations involving type aliases.
In a future release, < code > Alias< / code > types will also carry < a href = "https://go.dev/issue/46477" > type parameter information< / a > .
The new function < a href = "/pkg/go/types#Unalias" > < code > Unalias< / code > < / a > returns the actual type denoted by an
< code > Alias< / code > type (or any other < a href = "/pkg/go/types#Type" > < code > Type< / code > < / a > for that matter).
Because < code > Alias< / code > types may break existing type switches that do not know to check for them,
this functionality is controlled by a < a href = "/doc/godebug" > < code > GODEBUG< / code > < / a > field named < code > gotypesalias< / code > .
With < code > gotypesalias=0< / code > , everything behaves as before, and < code > Alias< / code > types are never created.
With < code > gotypesalias=1< / code > , < code > Alias< / code > types are created and clients must expect them.
The default is < code > gotypesalias=0< / code > .
In a future release, the default will be changed to < code > gotypesalias=1< / code > .
2023-12-04 12:13:32 -07:00
< / p >
2023-12-04 12:38:50 -07:00
< p > <!-- https://go.dev/issue/61035, multiple CLs, see issue for details -->
The implementation of < a href = "/pkg/go/types#SizesFor" > < code > SizesFor< / code > < / a > has been adjusted to compute
the same type sizes as the compiler when the compiler argument for < code > SizesFor< / code > is < code > "gc"< / code > .
The default < a href = "/pkg/go/types#Sizes" > < code > Sizes< / code > < / a > implementation used by the type checker is now
< code > types.SizesFor("gc", "amd64")< / code > .
2023-12-04 12:13:32 -07:00
< / p >
go/types: set correct Var.scopePos for parameters/results
Previously, its value was unset (NoPos), but the correct
value is a point after the signature (FuncType.End) and
before the body.
Also, fix a bug in Scope.Innermost whereby it would return
the wrong (outer) scope when the query position was in
the FuncType portion of a Func{Decl,Lit}.
The fix is to set the scope's pos/end to those of the
complete Func{Decl,Lit}. This is now documented at
Info.Scopes, along with other missing information.
Also, fix a bug in the go/types (but not types2) scope
test, in which comments were discarded by the parser,
causing the entire test to be a no-op (!).
Also, make failures of TestScopeLookupParent more
informative.
Also, add a release note about the change in behavior.
Fixes #64292
Fixes #64295
Change-Id: Ib681f59d1b0b43de977666db08302d7524d3305f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544035
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2023-11-20 15:22:37 -07:00
< p > <!-- https://go.dev/issue/64295, CL 544035 -->
2023-12-04 14:24:13 -07:00
The start position (< a href = "/pkg/go/types#Scope.Pos" > < code > Pos< / code > < / a > )
of the lexical environment block (< a href = "/pkg/go/types#Scope" > < code > Scope< / code > < / a > )
go/types: set correct Var.scopePos for parameters/results
Previously, its value was unset (NoPos), but the correct
value is a point after the signature (FuncType.End) and
before the body.
Also, fix a bug in Scope.Innermost whereby it would return
the wrong (outer) scope when the query position was in
the FuncType portion of a Func{Decl,Lit}.
The fix is to set the scope's pos/end to those of the
complete Func{Decl,Lit}. This is now documented at
Info.Scopes, along with other missing information.
Also, fix a bug in the go/types (but not types2) scope
test, in which comments were discarded by the parser,
causing the entire test to be a no-op (!).
Also, make failures of TestScopeLookupParent more
informative.
Also, add a release note about the change in behavior.
Fixes #64292
Fixes #64295
Change-Id: Ib681f59d1b0b43de977666db08302d7524d3305f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544035
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2023-11-20 15:22:37 -07:00
that represents a function body has changed:
it used to start at the opening curly brace of the function body,
but now starts at the function's < code > func< / code > token.
< / p >
2023-12-04 12:13:32 -07:00
< p > <!-- https://go.dev/issue/62605, CL 540056 -->
The < a href = "/pkg/go/types#Info" > < code > Info< / code > < / a > struct now exports the
< a href = "/pkg/go/types#Info.FileVersions" > < code > FileVersions< / code > < / a > map
which provides per-file Go version information.
< / p >
go/types: set correct Var.scopePos for parameters/results
Previously, its value was unset (NoPos), but the correct
value is a point after the signature (FuncType.End) and
before the body.
Also, fix a bug in Scope.Innermost whereby it would return
the wrong (outer) scope when the query position was in
the FuncType portion of a Func{Decl,Lit}.
The fix is to set the scope's pos/end to those of the
complete Func{Decl,Lit}. This is now documented at
Info.Scopes, along with other missing information.
Also, fix a bug in the go/types (but not types2) scope
test, in which comments were discarded by the parser,
causing the entire test to be a no-op (!).
Also, make failures of TestScopeLookupParent more
informative.
Also, add a release note about the change in behavior.
Fixes #64292
Fixes #64295
Change-Id: Ib681f59d1b0b43de977666db08302d7524d3305f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544035
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2023-11-20 15:22:37 -07:00
< / dd >
< / dl >
2023-08-09 12:17:42 -06:00
< dl id = "reflect" > < dt > < a href = "/pkg/reflect/" > reflect< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61827, CL 517777 -->
The < a href = "/pkg/reflect/#Value.IsZero" > < code > Value.IsZero< / code > < / a >
method will now return true for a floating-point or complex
negative zero, and will return true for a struct value if a
blank field (a field named < code > _< / code > ) somehow has a
non-zero value.
These changes make < code > IsZero< / code > consistent with comparing
2023-09-16 18:15:09 -06:00
a value to zero using the language < code > ==< / code > operator.
2023-08-09 12:17:42 -06:00
< / p >
< / dd >
2023-11-22 13:37:13 -07:00
< / dl > <!-- reflect -->
< dl id = "runtime/metrics" > < dt > < a href = "/pkg/runtime/metrics/" > runtime/metrics< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/63340 -->
TODO: < a href = "https://go.dev/issue/63340" > https://go.dev/issue/63340< / a > : provide histogram of all STW events
< / p >
< / dd >
< / dl > <!-- runtime/metrics -->
2023-11-30 14:14:52 -07:00
< dl id = "runtime/pprof" > < dt > < a href = "/pkg/runtime/pprof/" > runtime/pprof< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61015 -->
Mutex profiles now scale contention by the number of goroutines blocked on the mutex.
This provides a more accurate representation of the degree to which a mutex is a bottleneck in
a Go program.
For instance, if 100 goroutines are blocked on a mutex for 10 milliseconds, a mutex profile will
now record 1 second of delay instead of 10 milliseconds of delay.
< / p >
< p > <!-- https://go.dev/issue/50891 -->
CPU profiles on Darwin platforms now contain the process's memory map, enabling the disassembly
view in the pprof tool.
< / p >
< / dd >
< / dl > <!-- runtime/pprof -->
2023-11-30 12:11:58 -07:00
< dl id = "runtime/trace" > < dt > < a href = "/pkg/runtime/trace/" > runtime/trace< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/60773 -->
The execution tracer has been completely overhauled in this release, resolving several long-standing
issues and paving the way for new use-cases for execution traces.
< br / >
Execution traces now use the operating system's clock on most platforms (Windows excluded) so
it is possible to correlate them with traces produced by lower-level components.
Execution traces no longer depend on the reliability of the platform's clock to produce a correct trace.
Execution traces are now partitioned regularly on-the-fly and as a result may be processed in a
streamable way.
Execution traces now contain complete durations for all system calls.
Execution traces now contain information about the operating system threads that goroutines executed on.
The latency impact of starting and stopping execution traces has been dramatically reduced.
Execution traces may now begin or end during the garbage collection mark phase.
< br / >
To allow Go developers to take advantage of these improvements, an experimental
trace reading package is available at < a href = "/pkg/golang.org/x/exp/trace" > golang.org/x/exp/trace< / a > .
Note that this package only works on traces produced by programs built with Go 1.22 at the moment.
Please try out the package and provide feedback on
< a href = "https://github.com/golang/go/issues/62627" > the corresponding proposal issue< / a > .
< br / >
If you experience any issues with the new execution tracer implementation, you may switch back to the
old implementation by building your Go program with < code > GOEXPERIMENT=noexectracer2< / code > .
If you do, please file an issue, otherwise this option will be removed in a future release.
< / p >
< / dd >
< / dl > <!-- runtime/trace -->
2023-11-22 13:37:13 -07:00
< dl id = "slices" > < dt > < a href = "/pkg/slices/" > slices< / a > < / dt >
< dd >
2023-12-01 13:54:00 -07:00
< p > <!-- https://go.dev/issue/56353 --> <!-- CL 504882 -->
The new function < code > Concat< / code > concatenates multiple slices.
2023-11-22 13:37:13 -07:00
< / p >
2023-12-01 13:54:00 -07:00
< p > <!-- https://go.dev/issue/63393 --> <!-- CL 543335 -->
Functions that shrink the size of a slice (< code > Delete< / code > , < code > DeleteFunc< / code > , < code > Compact< / code > , < code > CompactFunc< / code > , and < code > Replace< / code > ) now zero the elements between the new length and the old length.
2023-11-22 13:37:13 -07:00
< / p >
2023-12-01 13:54:00 -07:00
< p > <!-- https://go.dev/issue/63913 --> <!-- CL 540155 -->
< code > Insert< / code > now always panics if the argument < code > i< / code > is out of range. Previously it did not panic in this situation if there were no elements to be inserted.
2023-11-22 13:37:13 -07:00
< / p >
< / dd >
< / dl > <!-- slices -->
< dl id = "syscall" > < dt > < a href = "/pkg/syscall/" > syscall< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/60797 -->
TODO: < a href = "https://go.dev/issue/60797" > https://go.dev/issue/60797< / a > : undeprecate
< / p >
< p > <!-- CL 520266 -->
TODO: < a href = "https://go.dev/cl/520266" > https://go.dev/cl/520266< / a > : syscall: add support to get pidfd from ForkExec on Linux
< / p >
< p > <!-- CL 541015 -->
TODO: < a href = "https://go.dev/cl/541015" > https://go.dev/cl/541015< / a > : syscall: support O_SYNC flag for os.OpenFile on windows
< / p >
< / dd >
< / dl > <!-- syscall -->
< dl id = "testing/slogtest" > < dt > < a href = "/pkg/testing/slogtest/" > testing/slogtest< / a > < / dt >
< dd >
< p > <!-- https://go.dev/issue/61758 -->
TODO: < a href = "https://go.dev/issue/61758" > https://go.dev/issue/61758< / a > : support sub-tests
< / p >
< p > <!-- CL 516076 -->
TODO: < a href = "https://go.dev/cl/516076" > https://go.dev/cl/516076< / a > : testing/slogtest: add Run to run cases as subtests; modified api/next/61758.txt
< / p >
< / dd >
< / dl > <!-- testing/slogtest -->
2023-08-09 12:17:42 -06:00
2023-07-18 14:55:13 -06:00
< h2 id = "ports" > Ports< / h2 >
2023-12-05 10:30:19 -07:00
< h3 id = "darwin" > Darwin< / h3 >
< p > <!-- CL 461697 -->
On macOS on 64-bit x86 architecture (the < code > darwin/amd64< / code > port),
the Go toolchain now generates position-independent executables (PIE) by default.
Non-PIE binaries can be generated by specifying the < code > -buildmode=exe< / code >
build flag.
On 64-bit ARM-based macOS (the < code > darwin/arm64< / code > port),
the Go toolchain already generates PIE by default.
< / p >
2023-11-28 14:09:42 -07:00
< h3 id = "arm" > Arm< / h3 >
2023-11-22 13:37:13 -07:00
< p > <!-- CL 514907 -->
2023-11-28 14:09:42 -07:00
The < code > GOARM< / code > environment variable now allows you to select whether to use software or hardware floating point.
Previously, valid < code > GOARM< / code > values were < code > 5< / code > , < code > 6< / code > , or < code > 7< / code > . Now those same values can
be optionally followed by < code > ,softfloat< / code > or < code > ,hardfloat< / code > to select the floating-point implementation.
< / p >
< p >
This new option defaults to < code > softfloat< / code > for version < code > 5< / code > and < code > hardfloat< / code > for versions
< code > 6< / code > and < code > 7< / code > .
2023-07-18 14:55:13 -06:00
< / p >
2023-11-22 13:37:13 -07:00
< p > <!-- CL 481315 -->
TODO: < a href = "https://go.dev/cl/481315" > https://go.dev/cl/481315< / a > : runtime, cmd/go: enable memory sanitizer on linux/loong64
< / p >
< p > <!-- CL 517935 -->
TODO: < a href = "https://go.dev/cl/517935" > https://go.dev/cl/517935< / a > : cmd/dist,internal/platform: enable openbsd/ppc64 port
< / p >
< p > <!-- CL 537615 -->
TODO: < a href = "https://go.dev/cl/537615" > https://go.dev/cl/537615< / a > : debug/elf,cmd/link: add additional relocations for loong64; modified api/next/63725.txt
< / p >
< p > <!-- CL 469395 -->
TODO: < a href = "https://go.dev/cl/469395" > https://go.dev/cl/469395< / a > : debug/elf,cmd/link: add additional MIPS64 relocation type; modified api/next/61974.txt
< / p >