mirror of
https://github.com/golang/go
synced 2024-09-28 21:24:29 -06:00
eb413f7bcd
The most important parts of almost any release notes are the language and tool changes. Those should be the first two sections. Instead Ports interrupts the flow with information that usually matters only to very few users. Move Ports to the end of the release notes. Change-Id: I78492e91e368184fb5f8e8d44d63f35b8f14eeae Reviewed-on: https://go-review.googlesource.com/c/go/+/500957 TryBot-Bypass: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
1018 lines
41 KiB
HTML
1018 lines
41 KiB
HTML
<!--{
|
|
"Title": "Go 1.21 Release Notes",
|
|
"Path": "/doc/go1.21"
|
|
}-->
|
|
|
|
<!--
|
|
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.21</h2>
|
|
|
|
<p>
|
|
<strong>
|
|
Go 1.21 is not yet released. These are work-in-progress
|
|
release notes. Go 1.21 is expected to be released in August 2023.
|
|
</strong>
|
|
</p>
|
|
|
|
<h2 id="language">Changes to the language</h2>
|
|
|
|
<p>
|
|
Go 1.21 adds three new built-ins to the language.
|
|
|
|
<ul>
|
|
<li><!-- https://go.dev/issue/59488 -->
|
|
The new functions <code>min</code> and <code>max</code> compute the
|
|
smallest (or largest, for <code>max</code>) value of a fixed number
|
|
of given arguments.
|
|
See the language spec for
|
|
<a href="https://tip.golang.org/ref/spec#Min_and_max">details</a>.
|
|
</li>
|
|
<li><!-- https://go.dev/issue/56351 -->
|
|
The new function <code>clear</code> deletes all elements from a
|
|
map or zeroes all elements of a slice.
|
|
See the language spec for
|
|
<a href="https://tip.golang.org/ref/spec#Clear">details</a>.
|
|
</li>
|
|
</ul>
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/57411 -->
|
|
Package initialization order is now specified more precisely. The
|
|
new algorithm is:
|
|
<ul>
|
|
<li>
|
|
Sort all packages by import path.
|
|
</li>
|
|
<li>Repeat until the list of packages is empty:
|
|
<ul>
|
|
<li>
|
|
Find the first package in the list for which all imports are
|
|
already initialized.
|
|
</li>
|
|
<li>
|
|
Initialize that package and remove it from the list.
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
This may change the behavior of some programs that rely on a
|
|
specific initialization ordering that was not expressed by explicit
|
|
imports. The behavior of such programs was not well defined by the
|
|
spec in past releases. The new rule provides an unambiguous definition.
|
|
</p>
|
|
|
|
<p>
|
|
Multiple improvements that increase the power and precision of type inference have been made.
|
|
</p>
|
|
<ul>
|
|
<li><!-- https://go.dev/issue/59338 -->
|
|
A (possibly partially instantiated generic) function may now be called with arguments that are
|
|
themselves (possibly partially instantiated) generic functions.
|
|
The compiler will attempt to infer the missing type arguments of the callee (as before) and,
|
|
for each argument that is a generic function that is not fully instantiated,
|
|
its missing type arguments (new).
|
|
Typical use cases are calls to generic functions operating on containers
|
|
(such as <a href="/pkg/slices#IndexFunc">slices.IndexFunc</a>) where a function argument
|
|
may also be generic, and where the type argument of the called function and its arguments
|
|
are inferred from the container type.
|
|
More generally, a generic function may now be used without explicit instantiation when
|
|
it is assigned to a variable or returned as a result value if the type arguments can
|
|
be inferred from the assignment.
|
|
</li>
|
|
<li><!-- https://go.dev/issue/60353, https://go.dev/issue/57192, https://go.dev/issue/52397, https://go.dev/issue/41176 -->
|
|
Type inference now also considers methods when a value is assigned to an interface:
|
|
type arguments for type parameters used in method signatures may be inferred from
|
|
the corresponding parameter types of matching methods.
|
|
</li>
|
|
<li><!-- https://go.dev/issue/51593 https://go.dev/issue/39661 -->
|
|
Similarly, since a type argument must implement all the methods of its corresponding constraint,
|
|
the methods of the type argument and constraint are matched which may lead to the inference of
|
|
additional type arguments.
|
|
</li>
|
|
<li><!-- https://go.dev/issue/58671 -->
|
|
If multiple untyped constant arguments of different kinds (such as an untyped int and
|
|
an untyped floating-point constant) are passed to parameters with the same (not otherwise
|
|
specified) type parameter type, instead of an error, now type inference determines the
|
|
type using the same approach as an operator with untyped constant operands.
|
|
This change brings the types inferred from untyped constant arguments in line with the
|
|
types of constant expressions.
|
|
</li>
|
|
<li><!-- https://go.dev/issue/59750 -->
|
|
Type inference is now precise when matching corresponding types in assignments:
|
|
component types (such as the the elements of slices, or the parameter types in function signatures)
|
|
must be identical (given suitable type arguments) to match, otherwise inference fails.
|
|
This change produces more accurate error messages:
|
|
where in the past type inference may have succeeded incorrectly and lead to an invalid assignment,
|
|
the compiler now reports an inference error if two types can't possibly match.
|
|
</li>
|
|
</ul>
|
|
|
|
<p><!-- https://go.dev/issue/58650 -->
|
|
More generally, the description of
|
|
<a href="https://tip.golang.org/ref/spec#Type_inference">type inference</a>
|
|
in the language spec has been clarified.
|
|
Together, all these changes make type inference more powerful and inference failures less surprising.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/56986 -->
|
|
TODO: <a href="https://go.dev/issue/56986">https://go.dev/issue/56986</a>: extended backwards compatibility for Go
|
|
</p>
|
|
|
|
<!-- https://go.dev/issue/57969 -->
|
|
<p>
|
|
<!-- add GOEXPERIMENT=loopvar -->
|
|
</p>
|
|
|
|
|
|
<p>
|
|
TODO: complete this section
|
|
</p>
|
|
|
|
<h2 id="tools">Tools</h2>
|
|
|
|
<!-- https://go.dev/issue/15513 -->
|
|
<p>
|
|
<!-- support compiling all tests without running -->
|
|
</p>
|
|
|
|
<h3 id="go-command">Go command</h3>
|
|
|
|
<p><!-- https://go.dev/issue/58099, CL 474236 -->
|
|
The <code>-pgo</code> build flag now defaults to <code>-pgo=auto</code>,
|
|
and the restriction of specifying a single main package on the command
|
|
line is now removed. If a file named <code>default.pgo</code> is present
|
|
in the main package's directory, the <code>go</code> command will use
|
|
it to enable profile-guided optimization for building the corresponding
|
|
program.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/37708, CL 463837 -->
|
|
The new <code>go</code> <code>test</code> option
|
|
<code>-fullpath</code> prints full path names in test log messages,
|
|
rather than just base names.
|
|
</p>
|
|
|
|
<!-- CL 466397 -->
|
|
<p>
|
|
<!-- cmd/go: make go test build multiple executables; The go test command now supports using the -c flag with multiple packages. -->
|
|
</p>
|
|
|
|
<h3 id="cgo">Cgo</h3>
|
|
|
|
<p><!-- CL 490819 -->
|
|
In files that <code>import "C"</code>, the Go toolchain now
|
|
correctly reports errors for attempts to declare Go methods on C types.
|
|
</p>
|
|
|
|
<h2 id="runtime-changes">Runtime</h2>
|
|
|
|
<p>
|
|
TODO: complete this section, or delete if not needed
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/7181 -->
|
|
When printing very deep stacks, the runtime now prints the first 50
|
|
(innermost) frames followed by the bottom 50 (outermost) frames,
|
|
rather than just printing the first 100 frames. This makes it easier
|
|
to see how deeply recursive stacks started, and is especially
|
|
valuable for debugging stack overflows.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/59960 -->
|
|
On Linux platforms that support transparent huge pages, the Go runtime
|
|
now manages which parts of the heap may be backed by huge pages more
|
|
explicitly. This leads to better utilization of memory: small heaps
|
|
should see less memory used (up to 50% in pathological cases) while
|
|
large heaps should see fewer broken huge pages for dense parts of the
|
|
heap, improving CPU usage and latency by up to 1%.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/57069, https://go.dev/issue/56966 -->
|
|
As a result of runtime-internal garbage collection tuning,
|
|
applications may see up to a 40% reduction in application tail latency
|
|
and a small decrease in memory use. Some applications may also observe
|
|
a small loss in throughput.
|
|
|
|
The memory use decrease should be proportional to the loss in
|
|
throughput, such that the previous release's throughput/memory
|
|
tradeoff may be recovered (with little change to latency) by
|
|
increasing <code>GOGC</code> and/or <code>GOMEMLIMIT</code> slightly.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/51676 -->
|
|
Calls from C to Go on threads created in C require some setup to prepare for
|
|
Go execution. On Unix platforms, this setup is now preserved across multiple
|
|
calls from the same thread. This significantly reduces the overhead of
|
|
subsequent C to Go calls from ~1-3 microseconds per call to ~100-200
|
|
nanoseconds per call.
|
|
</p>
|
|
|
|
<h2 id="compiler">Compiler</h2>
|
|
|
|
<p>
|
|
Profile-guide optimization (PGO), added as a preview in Go 1.20, is now ready
|
|
for general use. PGO enables additional optimizations on code identified as
|
|
hot by profiles of production workloads. As mentioned in the
|
|
<a href="#go-command">Go command section</a>, PGO is enabled by default for
|
|
binaries that contain a <code>default.pgo</code> profile in the main
|
|
package directory. Performance improvements vary depending on application
|
|
behavior, with most programs from a representative set of Go programs seeing
|
|
between 2 and 7% improvement from enabling PGO. See the
|
|
<a href="/doc/pgo">PGO user guide</a> for detailed documentation.
|
|
</p>
|
|
|
|
<!-- https://go.dev/issue/59959 -->
|
|
<p>
|
|
PGO builds can now devirtualize some interface method calls, adding a
|
|
concrete call to the most common callee. This enables further optimization,
|
|
such as inlining the callee.
|
|
</p>
|
|
|
|
<p>
|
|
TODO: complete this section, or delete if not needed
|
|
</p>
|
|
|
|
<h2 id="assembler">Assembler</h2>
|
|
|
|
<!-- CL 476295 -->
|
|
<p>
|
|
The verifier that checks for incorrect uses of <code>R15</code> when dynamic linking on amd64 has been improved.
|
|
</p>
|
|
|
|
<h2 id="linker">Linker</h2>
|
|
|
|
<p><!-- https://go.dev/issue/57302, CL 461749 -->
|
|
On Windows AMD64, the linker (with help from the compiler) now emits
|
|
SEH unwinding data by default, which improves the integration
|
|
of Go applications with Windows debuggers and other tools.
|
|
</p>
|
|
|
|
<!-- CL 457455 -->
|
|
<p>
|
|
<!-- cmd/link: generate .xdata PE section -->
|
|
</p>
|
|
<!-- CL 463395, CL 461315 -->
|
|
<p>
|
|
In Go 1.21 the linker (with help from the compiler) is now capable of
|
|
deleting dead (unreferenced) global map variables, if the number of
|
|
entries in the variable initializer is sufficiently large, and if the
|
|
initializer expressions are side-effect free.
|
|
</p>
|
|
<p>
|
|
TODO: complete this section, or delete if not needed
|
|
</p>
|
|
|
|
<h2 id="library">Core library</h2>
|
|
|
|
<h3 id="slog">New log/slog package</h3>
|
|
|
|
<p><!-- https://go.dev/issue/59060, https://go.dev/issue/59141, https://go.dev/issue/59204, https://go.dev/issue/59280,
|
|
https://go.dev/issue/59282, https://go.dev/issue/59339, https://go.dev/issue/59345,
|
|
CL 477295, CL 484096, CL 486376, CL 486415, CL 487855 -->
|
|
The new <a href="/pkg/log/slog">log/slog</a> package provides structured logging with levels.
|
|
Structured logging emits key-value pairs
|
|
to enable fast, accurate processing of large amounts of log data.
|
|
The package supports integration with popular log analysis tools and services.
|
|
</p>
|
|
|
|
<h3 id="slogtest">New testing/slogtest package</h3>
|
|
|
|
<p><!-- CL 487895 -->
|
|
The new <a href="/pkg/testing/slogtest">testing/slogtest</a> package can help
|
|
to validate <a href="/pkg/log/slog#Handler">slog.Handler</a> implementations.
|
|
</p>
|
|
|
|
<h3 id="slices">New slices package</h3>
|
|
|
|
<p><!-- https://go.dev/issue/45955, https://go.dev/issue/54768, https://go.dev/issue/57348, https://go.dev/issue/57433, CL 467417, CL 483175 -->
|
|
The new <a href="/pkg/slices">slices</a> package provides many common
|
|
operations on slices, using generic functions that work with slices
|
|
of any element type.
|
|
</p>
|
|
|
|
<h3 id="maps">New maps package</h3>
|
|
|
|
<p><!-- https://go.dev/issue/57436, CL 464343 -->
|
|
The new <a href="/pkg/maps/">maps</a> package provides several
|
|
common operations on maps, using generic functions that work with
|
|
maps of any key or element type.
|
|
</p>
|
|
|
|
<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>
|
|
|
|
<dl id="archive/tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
|
|
interface returned by
|
|
<a href="/pkg/archive/tar/#Header.FileInfo"><code>Header.FileInfo</code></a>
|
|
now implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- archive/tar -->
|
|
|
|
<dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
|
|
interface returned by
|
|
<a href="/pkg/archive/zip/#FileHeader.FileInfo"><code>FileHeader.FileInfo</code></a>
|
|
now implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
|
|
interface returned by the
|
|
<a href="/pkg/io/fs/#ReadDirFile.ReadDir"><code>io/fs.ReadDirFile.ReadDir</code></a>
|
|
method of the
|
|
<a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
|
|
returned by
|
|
<a href="/pkg/archive/zip/#Reader.Open"><code>Reader.Open</code></a>
|
|
now implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- archive/zip -->
|
|
|
|
<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/53685, CL 474635 -->
|
|
The <a href="/pkg/bytes/#Buffer"><code>Buffer</code></a> type
|
|
has two new methods:
|
|
<a href="/pkg/bytes/#Buffer.Available"><code>Available</code></a>
|
|
and <a href="/pkg/bytes/#AvailableBuffer"><code>AvailableBuffer</code></a>.
|
|
These may be used along with the
|
|
<a href="/pkg/bytes/#Buffer.Write"><code>Write</code></a>
|
|
method to append directly to the <code>Buffer</code>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- bytes -->
|
|
|
|
<dl id="context"><dt><a href="/pkg/context/">context</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/40221, CL 479918 -->
|
|
The new <a href="/pkg/context/#WithoutCancel"><code>WithoutCancel</code></a>
|
|
function returns a copy of a context that is not canceled when the original
|
|
context is canceled.
|
|
</p>
|
|
<p><!-- https://go.dev/issue/56661, CL 449318 -->
|
|
The new <a href="/pkg/context/#WithDeadlineCause"><code>WithDeadlineCause</code></a>
|
|
and <a href="/pkg/context/#WithTimeoutCause"><code>WithTimeoutCause</code></a>
|
|
functions provide a way to set a context cancellation cause when a deadline or
|
|
timer expires. The cause may be retrieved with the
|
|
<a href="/pkg/context/#Cause"><code>Cause</code></a> function.
|
|
</p>
|
|
<p><!-- https://go.dev/issue/57928, CL 482695 -->
|
|
The new <a href="/pkg/context/#AfterFunc"><code>AfterFunc</code></a>
|
|
function registers a function to run after a context has been cancelled.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
|
|
<dd>
|
|
<p><!-- CL 459977 -->
|
|
All of the <a href="/pkg/crypto/elliptic/#Curve"><code>Curve</code></a> methods have been deprecated, along with <a href="/pkg/crypto/elliptic/#GenerateKey"><code>GenerateKey</code></a>, <a href="/pkg/crypto/elliptic/#Marshal"><code>Marshal</code></a>, and <a href="/pkg/crypto/elliptic/#Unmarshal"><code>Unmarshal</code></a>. For ECDH operations, the new <a href="/pkg/crypto/ecdh/"><code>crypto/ecdh</code></a> package should be used instead.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- crypto/elliptic -->
|
|
|
|
<dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56921, CL 459976 -->
|
|
The <a href="/pkg/crypto/rsa/#GenerateMultiPrimeKey"><code>GenerateMultiPrimeKey</code></a> function and the <a href="/pkg/crypto/rsa/#PrecomputedValues.CRTValues"><code>PrecomputedValues.CRTValues</code></a> field have been deprecated. <a href="/pkg/crypto/rsa/#PrecomputedValues.CRTValues"><code>PrecomputedValues.CRTValues</code></a> will still be populated when <a href="/pkg/crypto/rsa/#PrivateKey.Precompute"><code>PrivateKey.Precompute</code></a> is called, but the values will not be used during decryption operations.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- crypto/rsa -->
|
|
|
|
<dl id="crypto/sha256"><dt><a href="/pkg/crypto/sha256/">crypto/sha256</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/50543, CL 408795 -->
|
|
SHA-224 and SHA-256 operations now use native instructions when available when <code>GOOS=amd64</code>, providing a performance improvement on the order of 3-4x.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- crypto/sha256 -->
|
|
|
|
<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/53573, CL 468875 -->
|
|
<a href="/pkg/crypto/x509/#RevocationList.RevokedCertificates"><code>RevocationList.RevokedCertificates</code></a> has been deprecated and replaced with the new <a href="/pkg/crypto/x509/#RevocationList.Entries"><code>RevocationList.Entries</code></a> field, which is a slice of <a href="/pkg/crypto/x509/#RevocationListEntry"><code>RevocationListEntry</code></a>. <a href="/pkg/crypto/x509/#RevocationListEntry"><code>RevocationListEntry</code></a> contains all of the fields in <a href="/pkg/crypto/x509/#pkix.RevokedCertificate"><code>pkix.RevokedCertificate</code></a>, as well as the revocation reason code.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- crypto/x509 -->
|
|
|
|
<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56892, CL 452617 -->
|
|
The new
|
|
<a href="/pkg/debug/elf/#File.DynValue"><code>File.DynValue</code></a>
|
|
method may be used to retrieve the numeric values listed with a
|
|
given dynamic tag.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/56887, CL 452496 -->
|
|
The constant flags permitted in a <code>DT_FLAGS_1</code>
|
|
dynamic tag are now defined with type
|
|
<a href="/pkg/debug/elf/#DynFlag1"><code>DynFlag1</code></a>. These
|
|
tags have names starting with <code>DF_1</code>.
|
|
</p>
|
|
|
|
<p><!-- CL 473256 -->
|
|
The package now defines the constant
|
|
<a href="/pkg/debug/elf/#COMPRESS_ZSTD"><code>COMPRESS_ZSTD</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- debug/elf -->
|
|
|
|
<dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
|
|
<dd>
|
|
<p><!-- CL 488475 -->
|
|
Attempts to read from a section containing uninitialized data
|
|
using
|
|
<a href="/pkg/debug/pe/#Section.Data"><code>Section.Data</code></a>
|
|
or the reader returned by <a href="/pkg/debug/pe/#Section.Open"><code>Section.Open</code></a>
|
|
now return an error.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- debug/pe -->
|
|
|
|
<dl id="embed"><dt><a href="/pkg/embed/">embed</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/57803, CL 483235 -->
|
|
The <a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
|
|
returned by
|
|
<a href="/pkg/embed/#FS.Open"><code>FS.Open</code></a> now
|
|
has a <code>ReadAt</code> method that
|
|
implements <a href="/pkg/io/#ReaderAt"><code>io.ReaderAt</code></a>.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
Calling <code><a href="/pkg/embed/FS.Open">FS.Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
|
|
will return a type that now implements a <code>String</code>
|
|
method that calls
|
|
<a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- embed -->
|
|
|
|
<dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/41198, CL 473935 -->
|
|
The new
|
|
<a href="/pkg/errors/#ErrUnsupported"><code>ErrUnsupported</code></a>
|
|
error provides a standardized way to indicate that a requested
|
|
operation may not be performed because it is unsupported.
|
|
For example, a call to
|
|
<a href="/pkg/os/#Link"><code>os.Link</code></a> when using a
|
|
file system that does not support hard links.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- errors -->
|
|
|
|
<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/53747, CL 476015 -->
|
|
The new <a href="/pkg/flag/#BoolFunc"><code>BoolFunc</code></a>
|
|
function and
|
|
<a href="/pkg/flag/#FlagSet.BoolFunc"><code>FlagSet.BoolFunc</code></a>
|
|
method define a flag that does not require an argument and calls
|
|
a function when the flag is used. This is similar to
|
|
<a href="/pkg/flag/#Func"><code>Func</code></a> but for a
|
|
boolean flag.
|
|
</p>
|
|
|
|
<p><!-- CL 480215 -->
|
|
A flag definition
|
|
(via <a href="/pkg/flag/#Bool"><code>Bool</code></a>,
|
|
<a href="/pkg/flag/#BoolVar"><code>BoolVar</code></a>,
|
|
<a href="/pkg/flag/#Int"><code>Int</code></a>,
|
|
<a href="/pkg/flag/#IntVar"><code>IntVar</code></a>, etc.)
|
|
will panic if <a href="/pkg/flag/#Set"><code>Set</code></a> has
|
|
already been called on a flag with the same name. This change is
|
|
intended to detect cases where <a href="#language">changes in
|
|
initialization order</a> cause flag operations to occur in a
|
|
different order than expected. In many cases the fix to this
|
|
problem is to introduce a explicit package dependence to
|
|
correctly order the definition before any
|
|
<a href="/pkg/flag/#Set"><code>Set</code></a> operations.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- flag -->
|
|
|
|
<dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/28089, CL 487935 -->
|
|
The new <a href="/pkg/go/ast/#IsGenerated"><code>IsGenerated</code></a> predicate
|
|
reports whether a file syntax tree contains the
|
|
<a href="https://go.dev/s/generatedcode">special comment</a>
|
|
that conventionally indicates that the file was generated by a tool.
|
|
</p>
|
|
</dd>
|
|
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/59033, CL 476276 -->
|
|
The new
|
|
<a href="/pkg/go/ast/#File.GoVersion"><code>File.GoVersion</code></a>
|
|
field records the minimum Go version required by
|
|
any <code>//go:build</code> or <code>// +build</code>
|
|
directives.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- go/ast -->
|
|
|
|
<dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56986, CL 453603 -->
|
|
The package now parses build directives (comments that start
|
|
with <code>//go:</code>) in file headers (before
|
|
the <code>package</code> declaration). These directives are
|
|
available in the new
|
|
<a href="/pkg/go/build#Package"><code>Package</code></a> fields
|
|
<a href="/pkg/go/build#Package.Directives"><code>Directives</code></a>,
|
|
<a href="/pkg/go/build#Package.TestDirectives"><code>TestDirectives</code></a>,
|
|
and
|
|
<a href="/pkg/go/build#Package.XTestDirectives"><code>XTestDirectives</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- go/build -->
|
|
|
|
<dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/59033, CL 476275 -->
|
|
The new
|
|
<a href="/pkg/go/build/constraint/#GoVersion"><code>GoVersion</code></a>
|
|
function returns the minimum Go version implied by a build
|
|
expression.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- go/build/constraint -->
|
|
|
|
<dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/57708, CL 464515 -->
|
|
The new <a href="/pkg/go/token/#File.Lines"><code>File.Lines</code></a> method
|
|
returns the file's line-number table in the same form as accepted by
|
|
<code>File.SetLines</code>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- go/token -->
|
|
|
|
<dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/47342, CL 468795 -->
|
|
The <code>hash/maphash</code> package now has a pure Go implementation, selectable with the <code>purego</code> build tag.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- hash/maphash -->
|
|
|
|
<dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/54451, CL 489555 -->
|
|
The new
|
|
<a href="/pkg/io/fs/#FormatFileInfo"><code>FormatFileInfo</code></a>
|
|
function returns a formatted version of a
|
|
<a href="/pkg/io/fs/#FileInfo"><code>FileInfo</code></a>.
|
|
The new
|
|
<a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>
|
|
function returns a formatted version of a
|
|
<a href="/pkg/io/fs/#FileInfo"><code>DirEntry</code></a>.
|
|
The implementation of
|
|
<a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
|
|
returned by
|
|
<a href="/pkg/io/fs/#ReadDir"><code>ReadDir</code></a> now
|
|
implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>,
|
|
and the same is true for
|
|
the <a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
|
|
value passed to
|
|
<a href="/pkg/io/fs/#WalkDirFunc"><code>WalkDirFunc</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- io/fs -->
|
|
|
|
<!-- https://go.dev/issue/56491 rolled back -->
|
|
<!-- CL 459435 reverted -->
|
|
<!-- CL 467515 reverted -->
|
|
|
|
<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56984, CL 453115 -->
|
|
The new <a href="/pkg/math/big/#Int.Float64"><code>Int.Float64</code></a>
|
|
method returns the nearest floating-point value to a
|
|
multi-precision integer, along with an indication of any
|
|
rounding that occurred.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- math/big -->
|
|
|
|
<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
|
|
<dd>
|
|
<p>
|
|
<!-- https://go.dev/issue/59166, https://go.dev/issue/56539 -->
|
|
<!-- CL 471136, CL 471137, CL 471140 -->
|
|
On Linux, the <a href="/pkg/net/">net</a> package can now use
|
|
Multipath TCP when the kernel supports it. It is not used by
|
|
default. To use Multipath TCP when available on a client, call
|
|
the
|
|
<a href="/pkg/net/#Dialer.SetMultipathTCP"><code>Dialer.SetMultipathTCP</code></a>
|
|
method before calling the
|
|
<a href="/pkg/net/#Dialer.Dial"><code>Dialer.Dial</code></a> or
|
|
<a href="/pkg/net/#Dialer.DialContext"><code>Dialer.DialContext</code></a>
|
|
methods. To use Multipath TCP when available on a server, call
|
|
the
|
|
<a href="/pkg/net/#ListenConfig.SetMultipathTCP"><code>ListenConfig.SetMultipathTCP</code></a>
|
|
method before calling the
|
|
<a href="/pkg/net/#ListenConfig.Listen"><code>ListenConfig.Listen</code></a>
|
|
method. Specify the network as <code>"tcp"</code> or
|
|
<code>"tcp4"</code> or <code>"tcp6"</code> as usual. If
|
|
Multipath TCP is not supported by the kernel or the remote host,
|
|
the connection will silently fall back to TCP. To test whether a
|
|
particular connection is using Multipath TCP, use the
|
|
<a href="/pkg/net/#TCPConn.MultipathTCP"><code>TCPConn.MultipathTCP</code></a>
|
|
method.
|
|
</p>
|
|
<p>
|
|
In a future Go release we may enable Multipath TCP by default on
|
|
systems that support it.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- net -->
|
|
|
|
<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/44855, CL 382117 -->
|
|
The new <a href="/pkg/net/http/#ErrSchemeMismatch"><code>ErrSchemeMismatch</code></a> error is returned by <a href="/pkg/net/http/#Client"><code>Client</code></a> and <a href="/pkg/net/http/#Transport"><code>Transport</code></a> when the server responds to an HTTPS request with an HTTP response.
|
|
</p>
|
|
|
|
<p><!-- CL 472636 -->
|
|
TODO: <a href="https://go.dev/cl/472636">https://go.dev/cl/472636</a>: net/http: support full-duplex HTTP/1 responses; modified api/next/57786.txt
|
|
</p>
|
|
|
|
<p><!-- CL 494122 -->
|
|
The <a href="/pkg/net/http/">net/http</a> package now supports
|
|
<a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
|
|
in that the expression
|
|
<code>errors.Is(http.ErrNotSupported, errors.ErrUnsupported)</code>
|
|
will return true.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- net/http -->
|
|
|
|
<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/32558, CL 219638 -->
|
|
Programs may now pass an empty <code>time.Time</code> value to
|
|
the <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> function
|
|
to leave either the access time or the modification time unchanged.
|
|
</p>
|
|
|
|
<p><!-- CL 480135 -->
|
|
On Windows the
|
|
<a href="/pkg/os#File.Chdir"><code>File.Chdir</code></a> method
|
|
now changes the current directory to the file, rather than
|
|
always returning an error.
|
|
</p>
|
|
|
|
<p><!-- CL 477215 -->
|
|
On Windows calling
|
|
<a href="/pkg/os/#Truncate"><code>Truncate</code></a> on a
|
|
non-existent file used to create an empty file. It now returns
|
|
an error indicating that the file does not exist.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/56899, CL 463219 -->
|
|
On Windows calling
|
|
<a href="/pkg/os/#TempDir"><code>TempDir</code></a> now uses
|
|
GetTempPath2W when available, instead of GetTempPathW. The
|
|
new behavior is a security hardening measure that prevents
|
|
temporary files created by processes running as SYSTEM to
|
|
be accessed by non-SYSTEM processes.
|
|
</p>
|
|
|
|
<p><!-- CL 493036 -->
|
|
On Windows the os package now supports working with files whose
|
|
names, stored as UTF-16, can't be represented as valid UTF-8.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
|
|
interface returned by the
|
|
<a href="/pkg/os/#ReadDir"><code>ReadDir</code></a> function and
|
|
the <a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>
|
|
method now implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/53761, CL 416775, CL 498015-->
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#FS"><code>io/fs.FS</code></a> interface returned by
|
|
the <a href="/pkg/os/#DirFS"><code>DirFS</code></a> function now implements
|
|
the <a href="/pkg/io/fs/#ReadFileFS"><code>io/fs.ReadFileFS</code></a> and
|
|
the <a href="/pkg/io/fs/#ReadDirFS"><code>io/fs.ReadDirFS</code></a>
|
|
interfaces.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- os -->
|
|
|
|
<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
|
|
<dd>
|
|
<p>
|
|
The implementation of the
|
|
<a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
|
|
interface passed to the function argument of
|
|
<a href="/pkg/path/filepath/#WalkDir"><code>WalkDir</code></a>
|
|
now implements a <code>String</code> method that calls
|
|
<a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- path/filepath -->
|
|
|
|
<!-- CL 459455 reverted -->
|
|
|
|
<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
|
|
<dd>
|
|
<p><!-- CL 408826, CL 413474 -->
|
|
In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
|
|
no longer forces its argument to be allocated on the heap, allowing
|
|
a <code>Value</code>'s content to be allocated on the stack. Most
|
|
operations on a <code>Value</code> also allow the underlying value
|
|
to be stack allocated.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/55002 -->
|
|
The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
|
|
method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
|
|
clears the contents of a map or zeros the contents of a slice.
|
|
This corresponds to the new <code>clear</code> built-in
|
|
<a href="#language">added to the language</a>.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/56906, CL 452762 -->
|
|
The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
|
|
and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
|
|
types are now deprecated. In new code
|
|
prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
|
|
<a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
|
|
<a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
|
|
or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- reflect -->
|
|
|
|
<dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/46159, CL 479401 -->
|
|
<a href="/pkg/regexp#Regexp"><code>Regexp</code></a> now defines
|
|
<a href="/pkg/regexp#Regexp.MarshalText"><code>MarshalText</code></a>
|
|
and <a href="/pkg/regexp#Regexp.UnmarshalText"><code>UnmarshalText</code></a>
|
|
methods. These implement
|
|
<a href="/pkg/encoding#TextMarshaler"><code>encoding.TextMarshaler</code></a>
|
|
and
|
|
<a href="/pkg/encoding#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>
|
|
and will be used by packages such as
|
|
<a href="/pkg/encoding/json">encoding/json</a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- regexp -->
|
|
|
|
<dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/38651 -->
|
|
TODO: <a href="https://go.dev/issue/38651">https://go.dev/issue/38651</a>: add 'created by goroutine number' to stack traces
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/57441, CL 474915 -->
|
|
Crashing Go applications can now opt-in to Windows Error Reporting (WER) by setting the environment variable
|
|
<code>GOTRACEBACK=wer</code> or calling <a href="/pkg/runtime/debug/#SetTraceback"><code>debug.SetTraceback("wer")</code></a>
|
|
before the crash. Other than enabling WER, the runtime will behave as with <code>GOTRACEBACK=crash</code>.
|
|
On non-Windows systems, <code>GOTRACEBACK=wer</code> is ignored.
|
|
</p>
|
|
|
|
<p><!-- CL 447778 -->
|
|
<code>GODEBUG=cgocheck=2</code>, a thorough checker of cgo pointer passing rules,
|
|
is no longer available as a <a href="/pkg/runtime#hdr-Environment_Variables">debug option</a>.
|
|
Instead, it is available as an experiment using <code>GOEXPERIMENT=cgocheck2</code>.
|
|
In particular this means that this mode has to be selected at build time instead of startup time.
|
|
<p>
|
|
<code>GODEBUG=cgocheck=1</code> is still available (and is still the default).
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/46787 -->
|
|
A new type <code>Pinner</code> has been added to the runtime
|
|
package. <code>Pinner</code>s may be used to "pin" Go memory
|
|
such that it may be used more freely by non-Go code. For instance,
|
|
passing Go values that reference pinned Go memory to C code is
|
|
now allowed. Previously, passing any such nested reference was
|
|
disallowed by the
|
|
<a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
|
|
|
|
See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- runtime -->
|
|
|
|
<dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/16638 -->
|
|
Collecting traces on amd64 and arm64 now incurs a substantially
|
|
smaller CPU cost: up to a 10x improvement over the previous release.
|
|
</p>
|
|
|
|
<p><!-- CL 494495 -->
|
|
Traces now contain explicit stop-the-world events for every reason
|
|
the Go runtime might stop-the-world, not just garbage collection.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- runtime/trace -->
|
|
|
|
<dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56857 -->
|
|
A few previously-internal GC metrics, such as live heap size, are
|
|
now available.
|
|
|
|
<code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
|
|
available as metrics.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- runtime/metrics -->
|
|
|
|
<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/56102, CL 451356 -->
|
|
The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
|
|
<a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
|
|
<a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
|
|
functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
|
|
lazily initialize a value on first use.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
|
|
<dd>
|
|
<p><!-- CL 480135 -->
|
|
On Windows the
|
|
<a href="/pkg/syscall#Fchdir"><code>Fchdir</code></a> function
|
|
now changes the current directory to its argument, rather than
|
|
always returning an error.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/46259, CL 458335 -->
|
|
On FreeBSD
|
|
<a href="/pkg/syscall#SysProcAttr"><code>SysProcAttr</code></a>
|
|
has a new field <code>Jail</code> that may be used to put the
|
|
newly created process in a jailed environment.
|
|
</p>
|
|
|
|
<p><!-- CL 493036 -->
|
|
On Windows the syscall package now supports working with files whose
|
|
names, stored as UTF-16, can't be represented as valid UTF-8.
|
|
The <a href="/pkg/syscall#UTF16ToString"><code>UTF16ToString</code></a>
|
|
and <a href="/pkg/syscall#UTF16FromString"><code>UTF16FromString</code></a>
|
|
functions now convert between UTF-16 data and
|
|
<a href="https://simonsapin.github.io/wtf-8/">WTF-8</a> strings.
|
|
This is backward compatible as WTF-8 is a superset of the UTF-8
|
|
format that was used in earlier releases.
|
|
</p>
|
|
|
|
<p><!-- CL 476578, CL 476875, CL 476916 -->
|
|
Several error values match the new
|
|
<a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
|
|
such that <code>errors.Is(err, errors.ErrUnsupported)</code>
|
|
returns true.
|
|
<ul>
|
|
<li><code>ENOSYS</code></li>
|
|
<li><code>ENOTSUP</code></li>
|
|
<li><code>EOPNOTSUPP</code></li>
|
|
<li><code>EPLAN9</code> (Plan 9 only)</li>
|
|
<li><code>ERROR_CALL_NOT_IMPLEMENTED</code> (Windows only)</li>
|
|
<li><code>ERROR_NOT_SUPPORTED</code> (Windows only)</li>
|
|
<li><code>EWINDOWS</code> (Windows only)</li>
|
|
</ul>
|
|
</p>
|
|
</dd>
|
|
</dl><!-- syscall -->
|
|
|
|
<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/37708, CL 463837 -->
|
|
The new <code>-test.fullpath</code> option will print full path
|
|
names in test log messages, rather than just base names.
|
|
</p>
|
|
|
|
<p><!-- https://go.dev/issue/52600, CL 475496 -->
|
|
The new <a href="/pkg/testing/#Testing"><code>Testing</code></a> function reports whether the program is a test created by <code>go</code> <code>test</code>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- testing -->
|
|
|
|
<dl id="testing/fstest"><dt><a href="/pkg/testing/fstest/">testing/fstest</a></dt>
|
|
<dd>
|
|
<p><!-- https://go.dev/issue/54451, CL 491175 -->
|
|
Calling <code><a href="/pkg/testing/fstest/MapFS.Open">Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
|
|
will return a type that now implements a <code>String</code>
|
|
method that calls
|
|
<a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
|
|
</p>
|
|
</dd>
|
|
</dl><!-- testing/fstest -->
|
|
|
|
<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
|
|
<dd>
|
|
<p><!-- CL 456837 -->
|
|
The <a href="/pkg/unicode/"><code>unicode</code></a> package and
|
|
associated support throughout the system has been upgraded to
|
|
<a href="https://www.unicode.org/versions/Unicode15.0.0/">Unicode 15.0.0</a>.
|
|
</p>
|
|
</dl><!-- unicode -->
|
|
|
|
<h2 id="ports">Ports</h2>
|
|
|
|
<h3 id="darwin">Darwin</h3>
|
|
|
|
<p><!-- go.dev/issue/57125 -->
|
|
As <a href="go1.20#darwin">announced</a> in the Go 1.20 release notes,
|
|
Go 1.21 requires macOS 10.15 Catalina or later;
|
|
support for previous versions has been discontinued.
|
|
</p>
|
|
|
|
<h3 id="windows">Windows</h3>
|
|
|
|
<p><!-- go.dev/issue/57003, go.dev/issue/57004 -->
|
|
As <a href="go1.20#windows">announced</a> in the Go 1.20 release notes,
|
|
Go 1.21 requires at least Windows 10 or Windows Server 2016;
|
|
support for previous versions has been discontinued.
|
|
</p>
|
|
|
|
<!-- CL 470695 -->
|
|
<p>
|
|
<!-- cmd/dist: default to GOARM=7 on all non-arm systems -->
|
|
</p>
|
|
|
|
<h3 id="wasm">WebAssembly</h3>
|
|
|
|
<p><!-- https://go.dev/issue/38248, https://go.dev/issue/59149, CL 489255 -->
|
|
The new <code>go:wasmimport</code> directive can now be used in Go programs
|
|
to import functions from the WebAssembly host.
|
|
</p>
|
|
|
|
<!-- https://go.dev/issue/56100 -->
|
|
<p>
|
|
The Go scheduler now interacts much more efficiently with the
|
|
JavaScript event loop, especially in applications that block
|
|
frequently on asynchronous events.
|
|
</p>
|
|
|
|
|
|
<h3 id="wasip1">WebAssembly System Interface</h3>
|
|
|
|
<p><!-- https://go.dev/issue/58141 -->
|
|
Go 1.21 adds an experimental port to the <a href="https://wasi.dev/">
|
|
WebAssembly System Interface (WASI)</a>, Preview 1
|
|
(<code>GOOS=wasip1</code>, <code>GOARCH=wasm</code>).
|
|
</p>
|
|
|
|
<p>
|
|
As a result of the addition of the new <code>GOOS</code> value
|
|
"<code>wasip1</code>", Go files named <code>*_wasip1.go</code>
|
|
will now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored
|
|
by Go tools</a> except when that <code>GOOS</code> value is being
|
|
used.
|
|
If you have existing filenames matching that pattern, you will
|
|
need to rename them.
|
|
</p>
|
|
|
|
|
|
<!-- proposals for x repos that don't need to be mentioned here but
|
|
are picked up by the relnote tool. -->
|
|
<!-- https://go.dev/issue/54232 -->
|
|
<!-- https://go.dev/issue/57906 -->
|
|
<!-- https://go.dev/issue/58668 -->
|