]> Cypherpunks.ru repositories - gostls13.git/blob - doc/go1.21.html
doc/go1.21: NOFRAME heuristic changes
[gostls13.git] / doc / go1.21.html
1 <!--{
2         "Title": "Go 1.21 Release Notes",
3         "Path":  "/doc/go1.21"
4 }-->
5
6 <!--
7 NOTE: In this document and others in this directory, the convention is to
8 set fixed-width phrases with non-fixed-width spaces, as in
9 <code>hello</code> <code>world</code>.
10 Do not send CLs removing the interior tags from such phrases.
11 -->
12
13 <style>
14   main ul li { margin: 0.5em 0; }
15 </style>
16
17 <h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.21</h2>
18
19 <p>
20   <strong>
21     Go 1.21 is not yet released. These are work-in-progress
22     release notes. Go 1.21 is expected to be released in August 2023.
23   </strong>
24 </p>
25
26 <p>
27   The latest Go release, version 1.21, arrives six months after <a href="/doc/go1.20">Go 1.20</a>.
28   Most of its changes are in the implementation of the toolchain, runtime, and libraries.
29   As always, the release maintains the Go 1 <a href="/doc/go1compat">promise of compatibility</a>;
30   in fact, Go 1.21 <a href="#godebug">improves upon that promise</a>.
31   We expect almost all Go programs to continue to compile and run as before.
32 </p>
33
34 <p><!-- https://go.dev/issue/57631 -->
35   Go 1.21 introduces a small change to the numbering of releases.
36   In the past, we used Go 1.<i>N</i> to refer to both the overall Go language version and release family
37   as well as the first release in that family.
38   Starting in Go 1.21, the first release is now Go 1.<i>N</i>.0.
39   Today we are releasing both the Go 1.21 language and its initial implementation, the Go 1.21.0 release.
40   These notes refer to “Go 1.21”; tools like <code>go</code> <code>version</code> will report “<code>go1.21.0</code>”
41   (until you upgrade to Go 1.21.1).
42   See “<a href="/doc/toolchain#versions">Go versions</a>” in the “Go Toolchains” documentation for details
43   about the new version numbering.
44 </p>
45
46 <h2 id="language">Changes to the language</h2>
47
48 <p>
49   Go 1.21 adds three new built-ins to the language.
50
51   <ul>
52     <li><!-- https://go.dev/issue/59488 -->
53       The new functions <code>min</code> and <code>max</code> compute the
54       smallest (or largest, for <code>max</code>) value of a fixed number
55       of given arguments.
56       See the language spec for
57       <a href="https://tip.golang.org/ref/spec#Min_and_max">details</a>.
58     </li>
59     <li><!-- https://go.dev/issue/56351 -->
60       The new function <code>clear</code> deletes all elements from a
61       map or zeroes all elements of a slice.
62       See the language spec for
63       <a href="https://tip.golang.org/ref/spec#Clear">details</a>.
64     </li>
65   </ul>
66 </p>
67
68 <p><!-- https://go.dev/issue/57411 -->
69   Package initialization order is now specified more precisely. The
70   new algorithm is:
71   <ul>
72     <li>
73       Sort all packages by import path.
74     </li>
75     <li>Repeat until the list of packages is empty:
76       <ul>
77         <li>
78           Find the first package in the list for which all imports are
79           already initialized.
80         </li>
81         <li>
82           Initialize that package and remove it from the list.
83         </li>
84       </ul>
85     </li>
86   </ul>
87   This may change the behavior of some programs that rely on a
88   specific initialization ordering that was not expressed by explicit
89   imports. The behavior of such programs was not well defined by the
90   spec in past releases. The new rule provides an unambiguous definition.
91 </p>
92
93 <p>
94   Multiple improvements that increase the power and precision of type inference have been made.
95 </p>
96 <ul>
97   <li><!-- https://go.dev/issue/59338 -->
98     A (possibly partially instantiated generic) function may now be called with arguments that are
99     themselves (possibly partially instantiated) generic functions.
100     The compiler will attempt to infer the missing type arguments of the callee (as before) and,
101     for each argument that is a generic function that is not fully instantiated,
102     its missing type arguments (new).
103     Typical use cases are calls to generic functions operating on containers
104     (such as <a href="/pkg/slices#IndexFunc">slices.IndexFunc</a>) where a function argument
105     may also be generic, and where the type argument of the called function and its arguments
106     are inferred from the container type.
107     More generally, a generic function may now be used without explicit instantiation when
108     it is assigned to a variable or returned as a result value if the type arguments can
109     be inferred from the assignment.
110   </li>
111   <li><!-- https://go.dev/issue/60353, https://go.dev/issue/57192, https://go.dev/issue/52397, https://go.dev/issue/41176 -->
112     Type inference now also considers methods when a value is assigned to an interface:
113     type arguments for type parameters used in method signatures may be inferred from
114     the corresponding parameter types of matching methods.
115   </li>
116   <li><!-- https://go.dev/issue/51593 https://go.dev/issue/39661 -->
117     Similarly, since a type argument must implement all the methods of its corresponding constraint,
118     the methods of the type argument and constraint are matched which may lead to the inference of
119     additional type arguments.
120   </li>
121   <li><!-- https://go.dev/issue/58671 -->
122     If multiple untyped constant arguments of different kinds (such as an untyped int and
123     an untyped floating-point constant) are passed to parameters with the same (not otherwise
124     specified) type parameter type, instead of an error, now type inference determines the
125     type using the same approach as an operator with untyped constant operands.
126     This change brings the types inferred from untyped constant arguments in line with the
127     types of constant expressions.
128   </li>
129   <li><!-- https://go.dev/issue/59750 -->
130     Type inference is now precise when matching corresponding types in assignments:
131     component types (such as the the elements of slices, or the parameter types in function signatures)
132     must be identical (given suitable type arguments) to match, otherwise inference fails.
133     This change produces more accurate error messages:
134     where in the past type inference may have succeeded incorrectly and lead to an invalid assignment,
135     the compiler now reports an inference error if two types can't possibly match.
136   </li>
137 </ul>
138
139 <p><!-- https://go.dev/issue/58650 -->
140   More generally, the description of
141   <a href="https://tip.golang.org/ref/spec#Type_inference">type inference</a>
142   in the language spec has been clarified.
143   Together, all these changes make type inference more powerful and inference failures less surprising.
144 </p>
145
146 <!-- https://go.dev/issue/57969 -->
147 <p>
148   Go 1.21 includes a preview of a language change we are considering for a future version of Go:
149   making for loop variables per-iteration instead of per-loop, to avoid accidental sharing bugs.
150   For details about how to try that language change, see <a href="https://go.dev/wiki/LoopvarExperiment">the LoopvarExperiment wiki page</a>.
151 </p>
152
153 <p>
154   TODO: complete this section
155 </p>
156
157 <h2 id="tools">Tools</h2>
158 <p>
159   Go 1.21 adds improved support for backwards compatibility and forwards compatibility
160   in the Go toolchain.
161 </p>
162
163 <p><!-- https://go.dev/issue/56986 -->
164   To improve backwards compatibility, Go 1.21 formalizes
165   Go's use of the GODEBUG environment variable to control
166   the default behavior for changes that are non-breaking according to the
167   <a href="/doc/go1compat">compatibility policy</a>
168   but nonetheless may cause existing programs to break.
169   (For example, programs that depend on buggy behavior may break
170   when a bug is fixed, but bug fixes are not considered breaking changes.)
171   When Go must make this kind of behavior change,
172   it now chooses between the old and new behavior based on the
173   <code>go</code> line in the workspace's <code>go.work</code> file
174   or else the main module's <code>go.mod</code> file.
175   Upgrading to a new Go toolchain but leaving the <code>go</code> line
176   set to its original (older) Go version preserves the behavior of the older
177   toolchain.
178   With this compatibility support, the latest Go toolchain should always
179   be the best, most secure, implementation of an older version of Go.
180   See “<a href="/doc/godebug">Go, Backwards Compatibility, and GODEBUG</a>” for details.
181 </p>
182
183 <p><!-- https://go.dev/issue/57001 -->
184   To improve forwards compatibility, Go 1.21 now reads the <code>go</code> line
185   in a <code>go.work</code> or <code>go.mod</code> file as a strict
186   minimum requirement: <code>go</code> <code>1.21.0</code> means
187   that the workspace or module cannot be used with Go 1.20 or with Go 1.21rc1.
188   This allows projects that depend on fixes made in later versions of Go
189   to ensure that they are not used with earlier versions.
190   It also gives better error reporting for projects that make use of new Go features:
191   when the problem is that a newer Go version is needed,
192   that problem is reported clearly, instead of attempting to build the code
193   and instead printing errors about unresolved imports or syntax errors.
194 </p>
195
196 <p>
197   To make these new stricter version requirements easier to manage,
198   the <code>go</code> command can now invoke not just the toolchain
199   bundled in its own release but also other Go toolchain versions found in the PATH
200   or downloaded on demand.
201   If a <code>go.mod</code> or <code>go.work</code> <code>go</code> line
202   declares a minimum requirement on a newer version of Go, the <code>go</code>
203   command will find and run that version automatically.
204   The new <code>toolchain</code> directive sets a suggested minimum toolchain to use,
205   which may be newer than the strict <code>go</code> minimum.
206   See “<a href="/doc/toolchain">Go Toolchains</a>” for details.
207 </p>
208
209 <h3 id="go-command">Go command</h3>
210
211 <p><!-- https://go.dev/issue/58099, CL 474236 -->
212   The <code>-pgo</code> build flag now defaults to <code>-pgo=auto</code>,
213   and the restriction of specifying a single main package on the command
214   line is now removed. If a file named <code>default.pgo</code> is present
215   in the main package's directory, the <code>go</code> command will use
216   it to enable profile-guided optimization for building the corresponding
217   program.
218 </p>
219
220 <p>
221   The <code>-C</code> <code>dir</code> flag must now be the first
222   flag on the command-line when used.
223 </p>
224
225 <p><!-- https://go.dev/issue/37708, CL 463837 -->
226   The new <code>go</code> <code>test</code> option
227   <code>-fullpath</code> prints full path names in test log messages,
228   rather than just base names.
229 </p>
230
231 <p><!-- https://go.dev/issue/15513, CL 466397 -->
232   The <code>go</code> <code>test</code> <code>-c</code> flag now
233   supports writing test binaries for multiple packages, each to
234   <code>pkg.test</code> where <code>pkg</code> is the package name.
235   It is an error if more than one test package being compiled has a given package name.]
236 </p>
237
238 <p><!-- https://go.dev/issue/15513, CL 466397 -->
239   The <code>go</code> <code>test</code> <code>-o</code> flag now
240   accepts a directory argument, in which case test binaries are written to that
241   directory instead of the current directory.
242 </p>
243
244 <h3 id="cgo">Cgo</h3>
245
246 <p><!-- CL 490819 -->
247   In files that <code>import "C"</code>, the Go toolchain now
248   correctly reports errors for attempts to declare Go methods on C types.
249 </p>
250
251 <h2 id="runtime-changes">Runtime</h2>
252
253 <p>
254   TODO: complete this section, or delete if not needed
255 </p>
256
257 <p><!-- https://go.dev/issue/7181 -->
258   When printing very deep stacks, the runtime now prints the first 50
259   (innermost) frames followed by the bottom 50 (outermost) frames,
260   rather than just printing the first 100 frames. This makes it easier
261   to see how deeply recursive stacks started, and is especially
262   valuable for debugging stack overflows.
263 </p>
264
265 <p><!-- https://go.dev/issue/59960 -->
266   On Linux platforms that support transparent huge pages, the Go runtime
267   now manages which parts of the heap may be backed by huge pages more
268   explicitly. This leads to better utilization of memory: small heaps
269   should see less memory used (up to 50% in pathological cases) while
270   large heaps should see fewer broken huge pages for dense parts of the
271   heap, improving CPU usage and latency by up to 1%.
272 </p>
273
274 <p><!-- https://go.dev/issue/57069, https://go.dev/issue/56966 -->
275   As a result of runtime-internal garbage collection tuning,
276   applications may see up to a 40% reduction in application tail latency
277   and a small decrease in memory use. Some applications may also observe
278   a small loss in throughput.
279
280   The memory use decrease should be proportional to the loss in
281   throughput, such that the previous release's throughput/memory
282   tradeoff may be recovered (with little change to latency) by
283   increasing <code>GOGC</code> and/or <code>GOMEMLIMIT</code> slightly.
284 </p>
285
286 <p><!-- https://go.dev/issue/51676 -->
287   Calls from C to Go on threads created in C require some setup to prepare for
288   Go execution. On Unix platforms, this setup is now preserved across multiple
289   calls from the same thread. This significantly reduces the overhead of
290   subsequent C to Go calls from ~1-3 microseconds per call to ~100-200
291   nanoseconds per call.
292 </p>
293
294 <h2 id="compiler">Compiler</h2>
295
296 <p>
297   Profile-guide optimization (PGO), added as a preview in Go 1.20, is now ready
298   for general use. PGO enables additional optimizations on code identified as
299   hot by profiles of production workloads. As mentioned in the
300   <a href="#go-command">Go command section</a>, PGO is enabled by default for
301   binaries that contain a <code>default.pgo</code> profile in the main
302   package directory. Performance improvements vary depending on application
303   behavior, with most programs from a representative set of Go programs seeing
304   between 2 and 7% improvement from enabling PGO. See the
305   <a href="/doc/pgo">PGO user guide</a> for detailed documentation.
306 </p>
307
308 <!-- https://go.dev/issue/59959 -->
309 <p>
310   PGO builds can now devirtualize some interface method calls, adding a
311   concrete call to the most common callee. This enables further optimization,
312   such as inlining the callee.
313 </p>
314
315 <p>
316   TODO: complete this section, or delete if not needed
317 </p>
318
319 <h2 id="assembler">Assembler</h2>
320
321 <!-- https://go.dev/issue/58378 -->
322 <p>
323   On amd64, frameless nosplit assembly functions are no longer automatically marked as <code>NOFRAME</code>.
324   Instead, the <code>NOFRAME</code> attribute must be explicitly specified if desired,
325   which is already the behavior on other architectures supporting frame pointers.
326   With this, the runtime now maintains the frame pointers for stack transitions.
327 </p>
328
329 <!-- CL 476295 -->
330 <p>
331   The verifier that checks for incorrect uses of <code>R15</code> when dynamic linking on amd64 has been improved.
332 </p>
333
334 <h2 id="linker">Linker</h2>
335
336 <p><!-- https://go.dev/issue/57302, CL 461749 -->
337   On Windows AMD64, the linker (with help from the compiler) now emits
338   SEH unwinding data by default, which improves the integration
339   of Go applications with Windows debuggers and other tools.
340 </p>
341
342 <!-- CL 457455 -->
343 <p>
344   <!-- cmd/link: generate .xdata PE section -->
345 </p>
346 <!-- CL 463395, CL 461315 -->
347 <p>
348   In Go 1.21 the linker (with help from the compiler) is now capable of
349   deleting dead (unreferenced) global map variables, if the number of
350   entries in the variable initializer is sufficiently large, and if the
351   initializer expressions are side-effect free.
352 </p>
353 <p>
354   TODO: complete this section, or delete if not needed
355 </p>
356
357 <h2 id="library">Core library</h2>
358
359 <h3 id="slog">New log/slog package</h3>
360
361 <p><!-- https://go.dev/issue/59060, https://go.dev/issue/59141, https://go.dev/issue/59204, https://go.dev/issue/59280,
362         https://go.dev/issue/59282, https://go.dev/issue/59339, https://go.dev/issue/59345,
363         CL 477295, CL 484096, CL 486376, CL 486415, CL 487855 -->
364   The new <a href="/pkg/log/slog">log/slog</a> package provides structured logging with levels.
365   Structured logging emits key-value pairs
366   to enable fast, accurate processing of large amounts of log data.
367   The package supports integration with popular log analysis tools and services.
368 </p>
369
370 <h3 id="slogtest">New testing/slogtest package</h3>
371
372 <p><!-- CL 487895 -->
373   The new <a href="/pkg/testing/slogtest">testing/slogtest</a> package can help
374   to validate <a href="/pkg/log/slog#Handler">slog.Handler</a> implementations.
375 </p>
376
377 <h3 id="slices">New slices package</h3>
378
379 <p>
380   <!-- https://go.dev/issue/45955, https://go.dev/issue/54768 -->
381   <!-- https://go.dev/issue/57348, https://go.dev/issue/57433 -->
382   <!-- https://go.dev/issue/58565, https://go.dev/issue/60091 -->
383   <!-- CL 467417, CL 468855, CL 483175, CL 496078, CL 498175 -->
384   The new <a href="/pkg/slices">slices</a> package provides many common
385   operations on slices, using generic functions that work with slices
386   of any element type.
387 </p>
388
389 <h3 id="maps">New maps package</h3>
390
391 <p><!-- https://go.dev/issue/57436, CL 464343 -->
392   The new <a href="/pkg/maps/">maps</a> package provides several
393   common operations on maps, using generic functions that work with
394   maps of any key or element type.
395 </p>
396
397 <p><!-- https://go.dev/issue/59488, CL 469356 -->
398   The new <a href="/pkg/cmp/">cmp</a> package defines the type
399   constraint <a href="/pkg/cmp/#Ordered"><code>Ordered</code></a> and
400   two new generic functions
401   <a href="/pkg/cmp/#Less"><code>Less</code></a>
402   and <a href="/pkg/cmp/#Compare"><code>Compare</code></a> that are
403   useful with <a href="/ref/spec/#Comparison_operators">ordered
404   types</a>.
405 </p>
406
407 <h3 id="minor_library_changes">Minor changes to the library</h3>
408
409 <p>
410   As always, there are various minor changes and updates to the library,
411   made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
412   in mind.
413   There are also various performance improvements, not enumerated here.
414 </p>
415
416 <p>
417   TODO: complete this section
418 </p>
419
420 <dl id="archive/tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
421   <dd>
422     <p><!-- https://go.dev/issue/54451, CL 491175 -->
423       The implementation of the
424       <a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
425       interface returned by
426       <a href="/pkg/archive/tar/#Header.FileInfo"><code>Header.FileInfo</code></a>
427       now implements a <code>String</code> method that calls
428       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
429     </p>
430   </dd>
431 </dl><!-- archive/tar -->
432
433 <dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
434   <dd>
435     <p><!-- https://go.dev/issue/54451, CL 491175 -->
436       The implementation of the
437       <a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
438       interface returned by
439       <a href="/pkg/archive/zip/#FileHeader.FileInfo"><code>FileHeader.FileInfo</code></a>
440       now implements a <code>String</code> method that calls
441       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
442     </p>
443
444     <p><!-- https://go.dev/issue/54451, CL 491175 -->
445       The implementation of the
446       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
447       interface returned by the
448       <a href="/pkg/io/fs/#ReadDirFile.ReadDir"><code>io/fs.ReadDirFile.ReadDir</code></a>
449       method of the
450       <a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
451       returned by
452       <a href="/pkg/archive/zip/#Reader.Open"><code>Reader.Open</code></a>
453       now implements a <code>String</code> method that calls
454       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
455     </p>
456   </dd>
457 </dl><!-- archive/zip -->
458
459 <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
460   <dd>
461     <p><!-- https://go.dev/issue/53685, CL 474635 -->
462       The <a href="/pkg/bytes/#Buffer"><code>Buffer</code></a> type
463       has two new methods:
464       <a href="/pkg/bytes/#Buffer.Available"><code>Available</code></a>
465       and <a href="/pkg/bytes/#AvailableBuffer"><code>AvailableBuffer</code></a>.
466       These may be used along with the
467       <a href="/pkg/bytes/#Buffer.Write"><code>Write</code></a>
468       method to append directly to the <code>Buffer</code>.
469     </p>
470   </dd>
471 </dl><!-- bytes -->
472
473 <dl id="context"><dt><a href="/pkg/context/">context</a></dt>
474   <dd>
475     <p><!-- https://go.dev/issue/40221, CL 479918 -->
476       The new <a href="/pkg/context/#WithoutCancel"><code>WithoutCancel</code></a>
477       function returns a copy of a context that is not canceled when the original
478       context is canceled.
479     </p>
480     <p><!-- https://go.dev/issue/56661, CL 449318 -->
481       The new <a href="/pkg/context/#WithDeadlineCause"><code>WithDeadlineCause</code></a>
482       and <a href="/pkg/context/#WithTimeoutCause"><code>WithTimeoutCause</code></a>
483       functions provide a way to set a context cancellation cause when a deadline or
484       timer expires. The cause may be retrieved with the
485       <a href="/pkg/context/#Cause"><code>Cause</code></a> function.
486     </p>
487     <p><!-- https://go.dev/issue/57928, CL 482695 -->
488       The new <a href="/pkg/context/#AfterFunc"><code>AfterFunc</code></a>
489       function registers a function to run after a context has been cancelled.
490     </p>
491   </dd>
492 </dl>
493
494 <dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
495   <dd>
496     <p><!-- CL 459977 -->
497       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.
498     </p>
499   </dd>
500 </dl><!-- crypto/elliptic -->
501
502 <dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
503   <dd>
504     <p><!-- https://go.dev/issue/56921, CL 459976 -->
505       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.
506     </p>
507   </dd>
508 </dl><!-- crypto/rsa -->
509
510 <!-- CL 483815 reverted -->
511
512 <dl id="crypto/sha256"><dt><a href="/pkg/crypto/sha256/">crypto/sha256</a></dt>
513   <dd>
514     <p><!-- https://go.dev/issue/50543, CL 408795 -->
515       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.
516     </p>
517   </dd>
518 </dl><!-- crypto/sha256 -->
519
520 <!-- CL 481478 reverted -->
521 <!-- CL 483816 reverted -->
522
523 <dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
524   <dd>
525     <p><!-- https://go.dev/issue/46308 -->
526       TODO: <a href="https://go.dev/issue/46308">https://go.dev/issue/46308</a>: add VersionName function to return a string version of the TLS Version
527     </p>
528
529     <p><!-- https://go.dev/issue/60107 -->
530       TODO: <a href="https://go.dev/issue/60107">https://go.dev/issue/60107</a>: QUIC 0-RTT APIs
531     </p>
532
533     <p><!-- CL 493655 -->
534       TODO: <a href="https://go.dev/cl/493655">https://go.dev/cl/493655</a>: crypto/tls: support QUIC as a transport; modified api/next/44886.txt
535     </p>
536
537     <p><!-- CL 496818 -->
538       TODO: <a href="https://go.dev/cl/496818">https://go.dev/cl/496818</a>: crypto/tls: add SessionState and use it on the server side; modified api/next/60105.txt
539     </p>
540
541     <p><!-- CL 496820 -->
542       TODO: <a href="https://go.dev/cl/496820">https://go.dev/cl/496820</a>: crypto/tls: add ClientSessionState.ResumptionState and NewResumptionState; modified api/next/60105.txt
543     </p>
544
545     <p><!-- CL 496821 -->
546       TODO: <a href="https://go.dev/cl/496821">https://go.dev/cl/496821</a>: crypto/tls: add WrapSession and UnwrapSession; modified api/next/60105.txt
547     </p>
548
549     <p><!-- CL 496822 -->
550       TODO: <a href="https://go.dev/cl/496822">https://go.dev/cl/496822</a>: crypto/tls: add SessionState.Extra; modified api/next/60105.txt
551     </p>
552
553     <p><!-- CL 496995 -->
554       TODO: <a href="https://go.dev/cl/496995">https://go.dev/cl/496995</a>: crypto/tls: add QUIC 0-RTT APIs; modified api/next/44886.txt, api/next/60107.txt
555     </p>
556
557     <p><!-- CL 497376 -->
558       TODO: <a href="https://go.dev/cl/497376">https://go.dev/cl/497376</a>: crypto/tls: implement Extended Master Secret; modified api/except.txt
559     </p>
560
561     <p><!-- CL 497377 -->
562       TODO: <a href="https://go.dev/cl/497377">https://go.dev/cl/497377</a>: crypto/tls: add VersionName; modified api/next/46308.txt
563     </p>
564   </dd>
565 </dl><!-- crypto/tls -->
566
567 <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
568   <dd>
569     <p><!-- https://go.dev/issue/53573, CL 468875 -->
570       <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.
571     </p>
572   </dd>
573 </dl><!-- crypto/x509 -->
574
575 <dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
576   <dd>
577     <p><!-- https://go.dev/issue/56892, CL 452617 -->
578       The new
579       <a href="/pkg/debug/elf/#File.DynValue"><code>File.DynValue</code></a>
580       method may be used to retrieve the numeric values listed with a
581       given dynamic tag.
582     </p>
583
584     <p><!-- https://go.dev/issue/56887, CL 452496 -->
585       The constant flags permitted in a <code>DT_FLAGS_1</code>
586       dynamic tag are now defined with type
587       <a href="/pkg/debug/elf/#DynFlag1"><code>DynFlag1</code></a>. These
588       tags have names starting with <code>DF_1</code>.
589     </p>
590
591     <p><!-- CL 473256 -->
592       The package now defines the constant
593       <a href="/pkg/debug/elf/#COMPRESS_ZSTD"><code>COMPRESS_ZSTD</code></a>.
594     </p>
595
596     <p><!-- https://go.dev/issue/60348, CL 496918 -->
597       The package now defines the constant
598       <a href="/pkg/debug/elf/#R_PPC64_REL24_P9NOTOC"><code>R_PPC64_REL24_P9NOTOC</code></a>.
599     </p>
600   </dd>
601 </dl><!-- debug/elf -->
602
603 <dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
604   <dd>
605     <p><!-- CL 488475 -->
606       Attempts to read from a section containing uninitialized data
607       using
608       <a href="/pkg/debug/pe/#Section.Data"><code>Section.Data</code></a>
609       or the reader returned by <a href="/pkg/debug/pe/#Section.Open"><code>Section.Open</code></a>
610       now return an error.
611     </p>
612   </dd>
613 </dl><!-- debug/pe -->
614
615 <dl id="embed"><dt><a href="/pkg/embed/">embed</a></dt>
616   <dd>
617     <p><!-- https://go.dev/issue/57803, CL 483235 -->
618       The <a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
619       returned by
620       <a href="/pkg/embed/#FS.Open"><code>FS.Open</code></a> now
621       has a <code>ReadAt</code> method that
622       implements <a href="/pkg/io/#ReaderAt"><code>io.ReaderAt</code></a>.
623     </p>
624
625     <p><!-- https://go.dev/issue/54451, CL 491175 -->
626       Calling <code><a href="/pkg/embed/FS.Open">FS.Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
627       will return a type that now implements a <code>String</code>
628       method that calls
629       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
630     </p>
631   </dd>
632 </dl><!-- embed -->
633
634 <dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
635   <dd>
636     <p><!-- https://go.dev/issue/41198, CL 473935 -->
637       The new
638       <a href="/pkg/errors/#ErrUnsupported"><code>ErrUnsupported</code></a>
639       error provides a standardized way to indicate that a requested
640       operation may not be performed because it is unsupported.
641       For example, a call to
642       <a href="/pkg/os/#Link"><code>os.Link</code></a> when using a
643       file system that does not support hard links.
644     </p>
645   </dd>
646 </dl><!-- errors -->
647
648 <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
649   <dd>
650     <p><!-- https://go.dev/issue/53747, CL 476015 -->
651       The new <a href="/pkg/flag/#BoolFunc"><code>BoolFunc</code></a>
652       function and
653       <a href="/pkg/flag/#FlagSet.BoolFunc"><code>FlagSet.BoolFunc</code></a>
654       method define a flag that does not require an argument and calls
655       a function when the flag is used. This is similar to
656       <a href="/pkg/flag/#Func"><code>Func</code></a> but for a
657       boolean flag.
658     </p>
659
660     <p><!-- CL 480215 -->
661       A flag definition
662       (via <a href="/pkg/flag/#Bool"><code>Bool</code></a>,
663       <a href="/pkg/flag/#BoolVar"><code>BoolVar</code></a>,
664       <a href="/pkg/flag/#Int"><code>Int</code></a>,
665       <a href="/pkg/flag/#IntVar"><code>IntVar</code></a>, etc.)
666       will panic if <a href="/pkg/flag/#Set"><code>Set</code></a> has
667       already been called on a flag with the same name. This change is
668       intended to detect cases where <a href="#language">changes in
669       initialization order</a> cause flag operations to occur in a
670       different order than expected. In many cases the fix to this
671       problem is to introduce a explicit package dependence to
672       correctly order the definition before any
673       <a href="/pkg/flag/#Set"><code>Set</code></a> operations.
674     </p>
675   </dd>
676 </dl><!-- flag -->
677
678 <dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
679   <dd>
680     <p><!-- https://go.dev/issue/28089, CL 487935 -->
681       The new <a href="/pkg/go/ast/#IsGenerated"><code>IsGenerated</code></a> predicate
682       reports whether a file syntax tree contains the
683       <a href="https://go.dev/s/generatedcode">special comment</a>
684       that conventionally indicates that the file was generated by a tool.
685     </p>
686   </dd>
687
688   <dd>
689     <p><!-- https://go.dev/issue/59033, CL 476276 -->
690       The new
691       <a href="/pkg/go/ast/#File.GoVersion"><code>File.GoVersion</code></a>
692       field records the minimum Go version required by
693       any <code>//go:build</code> or <code>// +build</code>
694       directives.
695     </p>
696   </dd>
697 </dl><!-- go/ast -->
698
699 <dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
700   <dd>
701     <p><!-- https://go.dev/issue/56986, CL 453603 -->
702       The package now parses build directives (comments that start
703       with <code>//go:</code>) in file headers (before
704       the <code>package</code> declaration). These directives are
705       available in the new
706       <a href="/pkg/go/build#Package"><code>Package</code></a> fields
707       <a href="/pkg/go/build#Package.Directives"><code>Directives</code></a>,
708       <a href="/pkg/go/build#Package.TestDirectives"><code>TestDirectives</code></a>,
709       and
710       <a href="/pkg/go/build#Package.XTestDirectives"><code>XTestDirectives</code></a>.
711     </p>
712   </dd>
713 </dl><!-- go/build -->
714
715 <dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
716   <dd>
717     <p><!-- https://go.dev/issue/59033, CL 476275 -->
718       The new
719       <a href="/pkg/go/build/constraint/#GoVersion"><code>GoVersion</code></a>
720       function returns the minimum Go version implied by a build
721       expression.
722     </p>
723   </dd>
724 </dl><!-- go/build/constraint -->
725
726 <dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
727   <dd>
728     <p><!-- https://go.dev/issue/57708, CL 464515 -->
729       The new <a href="/pkg/go/token/#File.Lines"><code>File.Lines</code></a> method
730       returns the file's line-number table in the same form as accepted by
731       <code>File.SetLines</code>.
732     </p>
733   </dd>
734 </dl><!-- go/token -->
735
736 <dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
737   <dd>
738     <p><!-- https://go.dev/issue/47342, CL 468795 -->
739       The <code>hash/maphash</code> package now has a pure Go implementation, selectable with the <code>purego</code> build tag.
740     </p>
741   </dd>
742 </dl><!-- hash/maphash -->
743
744 <dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
745   <dd>
746     <p><!-- https://go.dev/issue/59584, CL 496395 -->
747       The new error
748       <a href="/pkg/html/template/#ErrJSTemplate"><code>ErrJSTemplate</code></a>
749       is returned when an action appears in a JavaScript template
750       literal. Previously an unexported error was returned.
751     </p>
752   </dd>
753 </dl><!-- html/template -->
754
755 <dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
756   <dd>
757     <p><!-- https://go.dev/issue/54451, CL 489555 -->
758       The new
759       <a href="/pkg/io/fs/#FormatFileInfo"><code>FormatFileInfo</code></a>
760       function returns a formatted version of a
761       <a href="/pkg/io/fs/#FileInfo"><code>FileInfo</code></a>.
762       The new
763       <a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>
764       function returns a formatted version of a
765       <a href="/pkg/io/fs/#FileInfo"><code>DirEntry</code></a>.
766       The implementation of
767       <a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
768       returned by
769       <a href="/pkg/io/fs/#ReadDir"><code>ReadDir</code></a> now
770       implements a <code>String</code> method that calls
771       <a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>,
772       and the same is true for
773       the <a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
774       value passed to
775       <a href="/pkg/io/fs/#WalkDirFunc"><code>WalkDirFunc</code></a>.
776     </p>
777   </dd>
778 </dl><!-- io/fs -->
779
780 <!-- https://go.dev/issue/56491 rolled back by https://go.dev/issue/60519 -->
781 <!-- CL 459435 reverted by CL 467255 -->
782 <!-- CL 467515 reverted by CL 499416 -->
783
784 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
785   <dd>
786     <p><!-- https://go.dev/issue/56984, CL 453115, CL 500116 -->
787       The new <a href="/pkg/math/big/#Int.Float64"><code>Int.Float64</code></a>
788       method returns the nearest floating-point value to a
789       multi-precision integer, along with an indication of any
790       rounding that occurred.
791     </p>
792   </dd>
793 </dl><!-- math/big -->
794
795 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
796   <dd>
797     <p>
798       <!-- https://go.dev/issue/59166, https://go.dev/issue/56539 -->
799       <!-- CL 471136, CL 471137, CL 471140 -->
800       On Linux, the <a href="/pkg/net/">net</a> package can now use
801       Multipath TCP when the kernel supports it. It is not used by
802       default. To use Multipath TCP when available on a client, call
803       the
804       <a href="/pkg/net/#Dialer.SetMultipathTCP"><code>Dialer.SetMultipathTCP</code></a>
805       method before calling the
806       <a href="/pkg/net/#Dialer.Dial"><code>Dialer.Dial</code></a> or
807       <a href="/pkg/net/#Dialer.DialContext"><code>Dialer.DialContext</code></a>
808       methods. To use Multipath TCP when available on a server, call
809       the
810       <a href="/pkg/net/#ListenConfig.SetMultipathTCP"><code>ListenConfig.SetMultipathTCP</code></a>
811       method before calling the
812       <a href="/pkg/net/#ListenConfig.Listen"><code>ListenConfig.Listen</code></a>
813       method. Specify the network as <code>"tcp"</code> or
814       <code>"tcp4"</code> or <code>"tcp6"</code> as usual. If
815       Multipath TCP is not supported by the kernel or the remote host,
816       the connection will silently fall back to TCP. To test whether a
817       particular connection is using Multipath TCP, use the
818       <a href="/pkg/net/#TCPConn.MultipathTCP"><code>TCPConn.MultipathTCP</code></a>
819       method.
820     </p>
821     <p>
822       In a future Go release we may enable Multipath TCP by default on
823       systems that support it.
824     </p>
825   </dd>
826 </dl><!-- net -->
827
828 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
829   <dd>
830     <p><!-- CL 472636 -->
831       The new <a href="/pkg/net/http#ResponseController.EnableFullDuplex"><code>ResponseController.EnableFullDuplex</code></a>
832       method allows server handlers to concurrently read from an HTTP/1
833       request body while writing the response. Normally, the HTTP/1 server
834       automatically consumes any remaining request body before starting to
835       write the response, to avoid deadlocking clients which attempt to
836       write a complete request before reading the response. The
837       <code>EnableFullDuplex</code> method disables this behavior.
838     </p>
839
840     <p><!-- https://go.dev/issue/44855, CL 382117 -->
841       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.
842     </p>
843
844     <p><!-- CL 494122 -->
845       The <a href="/pkg/net/http/">net/http</a> package now supports
846       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
847       in that the expression
848       <code>errors.Is(http.ErrNotSupported, errors.ErrUnsupported)</code>
849       will return true.
850     </p>
851   </dd>
852 </dl><!-- net/http -->
853
854 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
855   <dd>
856     <p><!-- https://go.dev/issue/32558, CL 219638 -->
857       Programs may now pass an empty <code>time.Time</code> value to
858       the <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> function
859       to leave either the access time or the modification time unchanged.
860     </p>
861
862     <p><!-- CL 480135 -->
863       On Windows the
864       <a href="/pkg/os#File.Chdir"><code>File.Chdir</code></a> method
865       now changes the current directory to the file, rather than
866       always returning an error.
867     </p>
868
869     <p><!-- CL 495079 -->
870       On Unix systems, if a non-blocking descriptor is passed
871       to <a href="/pkg/os/#NewFile"><code>NewFile</code></a>, calling
872       the <a href="/pkg/os/#File.Fd"><code>File.Fd</code></a> method
873       will now return a non-blocking descriptor. Previously the
874       descriptor was converted to blocking mode.
875     </p>
876
877     <p><!-- CL 477215 -->
878       On Windows calling
879       <a href="/pkg/os/#Truncate"><code>Truncate</code></a> on a
880       non-existent file used to create an empty file. It now returns
881       an error indicating that the file does not exist.
882     </p>
883
884     <p><!-- https://go.dev/issue/56899, CL 463219 -->
885       On Windows calling
886       <a href="/pkg/os/#TempDir"><code>TempDir</code></a> now uses
887       GetTempPath2W when available, instead of GetTempPathW. The
888       new behavior is a security hardening measure that prevents
889       temporary files created by processes running as SYSTEM to
890       be accessed by non-SYSTEM processes.
891     </p>
892
893     <p><!-- CL 493036 -->
894       On Windows the os package now supports working with files whose
895       names, stored as UTF-16, can't be represented as valid UTF-8.
896     </p>
897
898     <p><!-- https://go.dev/issue/54451, CL 491175 -->
899       The implementation of the
900       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
901       interface returned by the
902       <a href="/pkg/os/#ReadDir"><code>ReadDir</code></a> function and
903       the <a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>
904       method now implements a <code>String</code> method that calls
905       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
906     </p>
907
908     <p><!-- https://go.dev/issue/53761, CL 416775, CL 498015-->
909     The implementation of the
910     <a href="/pkg/io/fs/#FS"><code>io/fs.FS</code></a> interface returned by
911     the <a href="/pkg/os/#DirFS"><code>DirFS</code></a> function now implements
912     the <a href="/pkg/io/fs/#ReadFileFS"><code>io/fs.ReadFileFS</code></a> and
913     the <a href="/pkg/io/fs/#ReadDirFS"><code>io/fs.ReadDirFS</code></a>
914     interfaces.
915     </p>
916   </dd>
917 </dl><!-- os -->
918
919 <dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
920   <dd>
921     <p>
922       The implementation of the
923       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
924       interface passed to the function argument of
925       <a href="/pkg/path/filepath/#WalkDir"><code>WalkDir</code></a>
926       now implements a <code>String</code> method that calls
927       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
928     </p>
929   </dd>
930 </dl><!-- path/filepath -->
931
932 <!-- CL 459455 reverted -->
933
934 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
935   <dd>
936     <p><!-- CL 408826, CL 413474 -->
937       In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
938       no longer forces its argument to be allocated on the heap, allowing
939       a <code>Value</code>'s content to be allocated on the stack. Most
940       operations on a <code>Value</code> also allow the underlying value
941       to be stack allocated.
942     </p>
943
944     <p><!-- https://go.dev/issue/55002 -->
945       The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
946       method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
947       clears the contents of a map or zeros the contents of a slice.
948       This corresponds to the new <code>clear</code> built-in
949       <a href="#language">added to the language</a>.
950     </p>
951
952     <p><!-- https://go.dev/issue/56906, CL 452762 -->
953       The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
954       and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
955       types are now deprecated. In new code
956       prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
957       <a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
958       <a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
959       or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
960     </p>
961   </dd>
962 </dl><!-- reflect -->
963
964 <dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
965   <dd>
966     <p><!-- https://go.dev/issue/46159, CL 479401 -->
967       <a href="/pkg/regexp#Regexp"><code>Regexp</code></a> now defines
968       <a href="/pkg/regexp#Regexp.MarshalText"><code>MarshalText</code></a>
969       and <a href="/pkg/regexp#Regexp.UnmarshalText"><code>UnmarshalText</code></a>
970       methods. These implement
971       <a href="/pkg/encoding#TextMarshaler"><code>encoding.TextMarshaler</code></a>
972       and
973       <a href="/pkg/encoding#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>
974       and will be used by packages such as
975       <a href="/pkg/encoding/json">encoding/json</a>.
976     </p>
977   </dd>
978 </dl><!-- regexp -->
979
980 <dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
981   <dd>
982     <p><!-- https://go.dev/issue/38651, CL 435337 -->
983       Textual stack traces produced by Go programs, such as those
984       produced when crashing, calling <code>runtime.Stack</code>, or
985       collecting a goroutine profile with <code>debug=2</code>, now
986       include the IDs of the goroutines that created each goroutine in
987       the stack trace.
988     </p>
989
990     <p><!-- https://go.dev/issue/57441, CL 474915 -->
991       Crashing Go applications can now opt-in to Windows Error Reporting (WER) by setting the environment variable
992       <code>GOTRACEBACK=wer</code> or calling <a href="/pkg/runtime/debug/#SetTraceback"><code>debug.SetTraceback("wer")</code></a>
993       before the crash. Other than enabling WER, the runtime will behave as with <code>GOTRACEBACK=crash</code>.
994       On non-Windows systems, <code>GOTRACEBACK=wer</code> is ignored.
995     </p>
996
997     <p><!-- CL 447778 -->
998       <code>GODEBUG=cgocheck=2</code>, a thorough checker of cgo pointer passing rules,
999       is no longer available as a <a href="/pkg/runtime#hdr-Environment_Variables">debug option</a>.
1000       Instead, it is available as an experiment using <code>GOEXPERIMENT=cgocheck2</code>.
1001       In particular this means that this mode has to be selected at build time instead of startup time.
1002     <p>
1003       <code>GODEBUG=cgocheck=1</code> is still available (and is still the default).
1004     </p>
1005
1006     <p><!-- https://go.dev/issue/46787, CL 367296 -->
1007       A new type <code>Pinner</code> has been added to the runtime
1008       package. <code>Pinner</code>s may be used to "pin" Go memory
1009       such that it may be used more freely by non-Go code. For instance,
1010       passing Go values that reference pinned Go memory to C code is
1011       now allowed. Previously, passing any such nested reference was
1012       disallowed by the
1013       <a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
1014
1015       See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
1016     </p>
1017
1018     <p><!-- CL 472195 -->
1019       TODO: <a href="https://go.dev/cl/472195">https://go.dev/cl/472195</a>: runtime: remove NOFRAME from asmcgocall, systemstack and mcall
1020     </p>
1021   </dd>
1022 </dl><!-- runtime -->
1023
1024 <dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
1025   <dd>
1026     <p><!-- https://go.dev/issue/56857, CL 497315 -->
1027       A few previously-internal GC metrics, such as live heap size, are
1028       now available.
1029
1030       <code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
1031       available as metrics.
1032     </p>
1033   </dd>
1034 </dl><!-- runtime/metrics -->
1035
1036 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
1037   <dd>
1038     <p><!-- https://go.dev/issue/16638 -->
1039       Collecting traces on amd64 and arm64 now incurs a substantially
1040       smaller CPU cost: up to a 10x improvement over the previous release.
1041     </p>
1042
1043     <p><!-- CL 494495 -->
1044       Traces now contain explicit stop-the-world events for every reason
1045       the Go runtime might stop-the-world, not just garbage collection.
1046     </p>
1047   </dd>
1048 </dl><!-- runtime/trace -->
1049
1050 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
1051   <dd>
1052     <p><!-- https://go.dev/issue/56102, CL 451356 -->
1053       The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
1054       <a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
1055       <a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
1056       functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
1057       lazily initialize a value on first use.
1058     </p>
1059   </dd>
1060 </dl>
1061
1062 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
1063   <dd>
1064     <p><!-- CL 480135 -->
1065       On Windows the
1066       <a href="/pkg/syscall#Fchdir"><code>Fchdir</code></a> function
1067       now changes the current directory to its argument, rather than
1068       always returning an error.
1069     </p>
1070
1071     <p><!-- https://go.dev/issue/46259, CL 458335 -->
1072       On FreeBSD
1073       <a href="/pkg/syscall#SysProcAttr"><code>SysProcAttr</code></a>
1074       has a new field <code>Jail</code> that may be used to put the
1075       newly created process in a jailed environment.
1076     </p>
1077
1078     <p><!-- CL 493036 -->
1079       On Windows the syscall package now supports working with files whose
1080       names, stored as UTF-16, can't be represented as valid UTF-8.
1081       The <a href="/pkg/syscall#UTF16ToString"><code>UTF16ToString</code></a>
1082       and <a href="/pkg/syscall#UTF16FromString"><code>UTF16FromString</code></a>
1083       functions now convert between UTF-16 data and
1084       <a href="https://simonsapin.github.io/wtf-8/">WTF-8</a> strings.
1085       This is backward compatible as WTF-8 is a superset of the UTF-8
1086       format that was used in earlier releases.
1087     </p>
1088
1089     <p><!-- CL 476578, CL 476875, CL 476916 -->
1090       Several error values match the new
1091       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
1092       such that <code>errors.Is(err, errors.ErrUnsupported)</code>
1093       returns true.
1094       <ul>
1095         <li><code>ENOSYS</code></li>
1096         <li><code>ENOTSUP</code></li>
1097         <li><code>EOPNOTSUPP</code></li>
1098         <li><code>EPLAN9</code> (Plan 9 only)</li>
1099         <li><code>ERROR_CALL_NOT_IMPLEMENTED</code> (Windows only)</li>
1100         <li><code>ERROR_NOT_SUPPORTED</code> (Windows only)</li>
1101         <li><code>EWINDOWS</code> (Windows only)</li>
1102       </ul>
1103     </p>
1104   </dd>
1105 </dl><!-- syscall -->
1106
1107 <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
1108   <dd>
1109     <p><!-- https://go.dev/issue/37708, CL 463837 -->
1110       The new <code>-test.fullpath</code> option will print full path
1111       names in test log messages, rather than just base names.
1112     </p>
1113
1114     <p><!-- https://go.dev/issue/52600, CL 475496 -->
1115       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>.
1116     </p>
1117   </dd>
1118 </dl><!-- testing -->
1119
1120 <dl id="testing/fstest"><dt><a href="/pkg/testing/fstest/">testing/fstest</a></dt>
1121   <dd>
1122     <p><!-- https://go.dev/issue/54451, CL 491175 -->
1123       Calling <code><a href="/pkg/testing/fstest/MapFS.Open">Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
1124       will return a type that now implements a <code>String</code>
1125       method that calls
1126       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
1127     </p>
1128   </dd>
1129 </dl><!-- testing/fstest -->
1130
1131 <dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
1132   <dd>
1133     <p><!-- CL 456837 -->
1134       The <a href="/pkg/unicode/"><code>unicode</code></a> package and
1135       associated support throughout the system has been upgraded to
1136       <a href="https://www.unicode.org/versions/Unicode15.0.0/">Unicode 15.0.0</a>.
1137     </p>
1138 </dl><!-- unicode -->
1139
1140 <h2 id="ports">Ports</h2>
1141
1142 <h3 id="darwin">Darwin</h3>
1143
1144 <p><!-- https://go.dev/issue/57125 -->
1145   As <a href="go1.20#darwin">announced</a> in the Go 1.20 release notes,
1146   Go 1.21 requires macOS 10.15 Catalina or later;
1147   support for previous versions has been discontinued.
1148 </p>
1149
1150 <h3 id="windows">Windows</h3>
1151
1152 <p><!-- https://go.dev/issue/57003, https://go.dev/issue/57004 -->
1153   As <a href="go1.20#windows">announced</a> in the Go 1.20 release notes,
1154   Go 1.21 requires at least Windows 10 or Windows Server 2016;
1155   support for previous versions has been discontinued.
1156 </p>
1157
1158 <!-- CL 470695 -->
1159 <p>
1160   <!-- cmd/dist: default to GOARM=7 on all non-arm systems -->
1161 </p>
1162
1163 <h3 id="wasm">WebAssembly</h3>
1164
1165 <p><!-- https://go.dev/issue/38248, https://go.dev/issue/59149, CL 489255 -->
1166   The new <code>go:wasmimport</code> directive can now be used in Go programs
1167   to import functions from the WebAssembly host.
1168 </p>
1169
1170 <!-- https://go.dev/issue/56100 -->
1171 <p>
1172   The Go scheduler now interacts much more efficiently with the
1173   JavaScript event loop, especially in applications that block
1174   frequently on asynchronous events.
1175 </p>
1176
1177
1178 <h3 id="wasip1">WebAssembly System Interface</h3>
1179
1180 <p><!-- https://go.dev/issue/58141 -->
1181   Go 1.21 adds an experimental port to the <a href="https://wasi.dev/">
1182   WebAssembly System Interface (WASI)</a>, Preview 1
1183   (<code>GOOS=wasip1</code>, <code>GOARCH=wasm</code>).
1184 </p>
1185
1186 <p>
1187   As a result of the addition of the new <code>GOOS</code> value
1188   "<code>wasip1</code>", Go files named <code>*_wasip1.go</code>
1189   will now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored
1190   by Go tools</a> except when that <code>GOOS</code> value is being
1191   used.
1192   If you have existing filenames matching that pattern, you will
1193   need to rename them.
1194 </p>
1195
1196
1197 <!-- proposals for x repos that don't need to be mentioned here but
1198      are picked up by the relnote tool. -->
1199 <!-- https://go.dev/issue/54232 -->
1200 <!-- https://go.dev/issue/57906 -->
1201 <!-- https://go.dev/issue/58668 -->
1202 <!-- https://go.dev/issue/59676 -->
1203
1204 <!-- changes to cmd/api that don't need release notes. -->
1205 <!-- CL 469115, CL 469135, CL 499981 -->
1206
1207 <!-- proposals that don't need release enotes. -->
1208 <!-- https://go.dev/issue/10275 -->
1209 <!-- https://go.dev/issue/59719 -->