]> Cypherpunks.ru repositories - gostls13.git/blob - doc/go1.21.html
91f0899c81a9c662a3c8d13f2bb7f5247795d0ee
[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 <h2 id="language">Changes to the language</h2>
27
28 <p>
29   Go 1.21 adds three new built-ins to the language.
30
31   <ul>
32     <li><!-- https://go.dev/issue/59488 -->
33       The new functions <code>min</code> and <code>max</code> compute the
34       smallest (or largest, for <code>max</code>) value of a fixed number
35       of given arguments.
36       See the language spec for
37       <a href="https://tip.golang.org/ref/spec#Min_and_max">details</a>.
38     </li>
39     <li><!-- https://go.dev/issue/56351 -->
40       The new function <code>clear</code> deletes all elements from a
41       map or zeroes all elements of a slice.
42       See the language spec for
43       <a href="https://tip.golang.org/ref/spec#Clear">details</a>.
44     </li>
45   </ul>
46 </p>
47
48 <p><!-- https://go.dev/issue/57411 -->
49   Package initialization order is now specified more precisely. The
50   new algorithm is:
51   <ul>
52     <li>
53       Sort all packages by import path.
54     </li>
55     <li>Repeat until the list of packages is empty:
56       <ul>
57         <li>
58           Find the first package in the list for which all imports are
59           already initialized.
60         </li>
61         <li>
62           Initialize that package and remove it from the list.
63         </li>
64       </ul>
65     </li>
66   </ul>
67   This may change the behavior of some programs that rely on a
68   specific initialization ordering that was not expressed by explicit
69   imports. The behavior of such programs was not well defined by the
70   spec in past releases. The new rule provides an unambiguous definition.
71 </p>
72
73 <p><!-- https://go.dev/issue/59338 -->
74   TODO: <a href="https://go.dev/issue/59338">https://go.dev/issue/59338</a>: infer type arguments from assignments of generic functions (reverse type inference)
75 </p>
76
77 <p><!-- https://go.dev/issue/56986 -->
78   TODO: <a href="https://go.dev/issue/56986">https://go.dev/issue/56986</a>: extended backwards compatibility for Go
79 </p>
80
81 <!-- https://go.dev/issue/57969 -->
82 <p>
83   <!-- add GOEXPERIMENT=loopvar -->
84 </p>
85
86
87 <p>
88   TODO: complete this section
89 </p>
90
91 <h2 id="ports">Ports</h2>
92
93 <!-- CL 470695 -->
94 <p>
95   <!-- cmd/dist: default to GOARM=7 on all non-arm systems -->
96 </p>
97
98 <!-- https://go.dev/issue/38248 -->
99 <p>
100   <!-- replace CallImport with go:wasmimport directive -->
101 </p>
102
103 <h3 id="wasm">WebAssembly</h3>
104
105 <!-- https://go.dev/issue/59149 -->
106 <p>
107   <!-- allow the use of go:wasmimport globally -->
108 </p>
109
110 <!-- CL 489255 -->
111 <p>
112   <!-- cmd/compile: remove go:wasmimport restriction -->
113 </p>
114
115 <!-- https://go.dev/issue/56100 -->
116 <p>
117   The Go scheduler now interacts much more efficiently with the
118   JavaScript event loop, especially in applications that block
119   frequently on asynchronous events.
120 </p>
121
122
123 <h3 id="wasip1">WebAssembly System Interface</h3>
124
125 <p><!-- https://go.dev/issue/58141 -->
126   Go 1.21 adds an experimental port to the <a href="https://wasi.dev/">
127   WebAssembly System Interface (WASI)</a>, Preview 1
128   (<code>GOOS=wasip1</code>, <code>GOARCH=wasm</code>).
129 </p>
130
131 <p>
132   As a result of the addition of the new <code>GOOS</code> value
133   "<code>wasip1</code>", Go files named <code>*_wasip1.go</code>
134   will now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored
135   by Go tools</a> except when that <code>GOOS</code> value is being
136   used.
137   If you have existing filenames matching that pattern, you will
138   need to rename them.
139 </p>
140
141 <h2 id="tools">Tools</h2>
142
143 <!-- https://go.dev/issue/15513 -->
144 <p>
145   <!-- support compiling all tests without running -->
146 </p>
147
148 <h3 id="go-command">Go command</h3>
149
150 <p><!-- https://go.dev/issue/58099, CL 474236 -->
151   The <code>-pgo</code> build flag now defaults to <code>-pgo=auto</code>,
152   and the restriction of specifying a single main package on the command
153   line is now removed. If a file named <code>default.pgo</code> is present
154   in the main package's directory, the <code>go</code> command will use
155   it to enable profile-guided optimization for building the corresponding
156   program.
157 </p>
158
159 <p><!-- https://go.dev/issue/37708, CL 463837 -->
160   The new <code>go</code> <code>test</code> option
161   <code>-fullpath</code> prints full path names in test log messages,
162   rather than just base names.
163 </p>
164
165 <!-- CL 466397 -->
166 <p>
167   <!-- cmd/go: make go test build multiple executables; The go test command now supports using the -c flag with multiple packages. -->
168 </p>
169
170 <h2 id="runtime-changes">Runtime</h2>
171
172 <p>
173   TODO: complete this section, or delete if not needed
174 </p>
175
176 <p><!-- https://go.dev/issue/7181 -->
177   When printing very deep stacks, the runtime now prints the first 50
178   (innermost) frames followed by the bottom 50 (outermost) frames,
179   rather than just printing the first 100 frames. This makes it easier
180   to see how deeply recursive stacks started, and is especially
181   valuable for debugging stack overflows.
182 </p>
183
184 <p><!-- https://go.dev/issue/59960 -->
185   On Linux platforms that support transparent huge pages, the Go runtime
186   now manages which parts of the heap may be backed by huge pages more
187   explicitly. This leads to better utilization of memory: small heaps
188   should see less memory used (up to 50% in pathological cases) while
189   large heaps should see fewer broken huge pages for dense parts of the
190   heap, improving CPU usage and latency by up to 1%.
191 </p>
192
193 <p><!-- https://go.dev/issue/57069, https://go.dev/issue/56966 -->
194   As a result of runtime-internal garbage collection tuning,
195   applications may see up to a 40% reduction in application tail latency
196   and a small decrease in memory use. Some applications may also observe
197   a small loss in throughput.
198
199   The memory use decrease should be proportional to the loss in
200   throughput, such that the previous release's throughput/memory
201   tradeoff may be recovered (with little change to latency) by
202   increasing <code>GOGC</code> and/or <code>GOMEMLIMIT</code> slightly.
203 </p>
204
205 <h2 id="compiler">Compiler</h2>
206
207 <!-- CL 490819 -->
208 <p>
209   <!-- cmd/cgo: reject attempts to declare methods on C types -->
210 </p>
211
212 <!-- CL 461315 -->
213 <p>
214   <!-- cmd/compile: enable deadcode of unreferenced large global maps -->
215 </p>
216
217 <p>
218   TODO: complete this section, or delete if not needed
219 </p>
220
221 <h2 id="assembler">Assembler</h2>
222
223 <!-- CL 476295 -->
224 <p>
225   The verifier that checks for incorrect uses of <code>R15</code> when dynamic linking on amd64 has been improved.
226 </p>
227
228 <h2 id="linker">Linker</h2>
229
230 <p><!-- https://go.dev/issue/57302, CL 461749 -->
231   On Windows AMD64, the linker (with help from the compiler) now emits
232   SEH unwinding data by default, which improves the integration
233   of Go applications with Windows debuggers and other tools.
234 </p>
235
236 <!-- CL 457455 -->
237 <p>
238   <!-- cmd/link: generate .xdata PE section -->
239 </p>
240 <!-- CL 463395 -->
241 <p>
242   In Go 1.21 the linker (with help from the compiler) is now capable of
243   deleting dead (unreferenced) global map variables, if the number of
244   entries in the variable initializer is sufficiently large, and if the
245   initializer expressions are side-effect free.
246 </p>
247 <p>
248   TODO: complete this section, or delete if not needed
249 </p>
250
251 <h2 id="library">Core library</h2>
252
253 <h3 id="slog">New log/slog package</h3>
254
255 <p>
256   The new <a href="/pkg/log/slog">log/slog</a> package provides structured logging with levels.
257   Structured logging emits key-value pairs
258   to enable fast, accurate processing of large amounts of log data.
259   The package supports integration with popular log analysis tools and services.
260 </p>
261
262 <h3 id="slices">New slices package</h3>
263
264 <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 -->
265   The new <a href="/pkg/slices">slices</a> package provides many common
266   operations on slices, using generic functions that work with slices
267   of any element type.
268 </p>
269
270 <h3 id="maps">New maps package</h3>
271
272 <p><!-- https://go.dev/issue/57436, CL 464343 -->
273   The new <a href="/pkg/maps/">maps</a> package provides several
274   common operations on maps, using generic functions that work with
275   maps of any key or element type.
276 </p>
277
278 <h3 id="minor_library_changes">Minor changes to the library</h3>
279
280 <p>
281   As always, there are various minor changes and updates to the library,
282   made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
283   in mind.
284   There are also various performance improvements, not enumerated here.
285 </p>
286
287 <p><!-- CL 456837 -->
288   TODO: <a href="https://go.dev/cl/456837">https://go.dev/cl/456837</a>: all: upgrade Unicode from 13.0.0 to 15.0.0; modified api/except.txt, api/next/55079.txt
289 </p>
290
291 <p>
292   TODO: complete this section
293 </p>
294
295 <dl id="archive/tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
296   <dd>
297     <p><!-- https://go.dev/issue/54451, CL 491175 -->
298       The implementation of the
299       <a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
300       interface returned by
301       <a href="/pkg/archive/tar/#Header.FileInfo"><code>Header.FileInfo</code></a>
302       now implements a <code>String</code> method that calls
303       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
304     </p>
305   </dd>
306 </dl><!-- archive/tar -->
307
308 <dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
309   <dd>
310     <p><!-- https://go.dev/issue/54451, CL 491175 -->
311       The implementation of the
312       <a href="/pkg/io/fs/#FileInfo"><code>io/fs.FileInfo</code></a>
313       interface returned by
314       <a href="/pkg/archive/zip/#FileHeader.FileInfo"><code>FileHeader.FileInfo</code></a>
315       now implements a <code>String</code> method that calls
316       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
317     </p>
318
319     <p><!-- https://go.dev/issue/54451, CL 491175 -->
320       The implementation of the
321       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
322       interface returned by the
323       <a href="/pkg/io/fs/#ReadDirFile.ReadDir"><code>io/fs.ReadDirFile.ReadDir</code></a>
324       method of the
325       <a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
326       returned by
327       <a href="/pkg/archive/zip/#Reader.Open"><code>Reader.Open</code></a>
328       now implements a <code>String</code> method that calls
329       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
330     </p>
331   </dd>
332 </dl><!-- archive/zip -->
333
334 <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
335   <dd>
336     <p><!-- https://go.dev/issue/53685 -->
337       TODO: <a href="https://go.dev/issue/53685">https://go.dev/issue/53685</a>: add Buffer.Available and Buffer.AvailableBuffer
338     </p>
339
340     <p><!-- CL 474635 -->
341       TODO: <a href="https://go.dev/cl/474635">https://go.dev/cl/474635</a>: bytes: add Buffer.Available and Buffer.AvailableBuffer; modified api/next/53685.txt
342     </p>
343   </dd>
344 </dl><!-- bytes -->
345
346 <dl id="context"><dt><a href="/pkg/context/">context</a></dt>
347   <dd>
348     <p><!-- https://go.dev/issue/40221, CL 479918 -->
349       The new <a href="/pkg/context/#WithoutCancel"><code>WithoutCancel</code></a>
350       function returns a copy of a context that is not canceled when the original
351       context is canceled.
352     </p>
353     <p><!-- https://go.dev/issue/56661, CL 449318 -->
354       The new <a href="/pkg/context/#WithDeadlineCause"><code>WithDeadlineCause</code></a>
355       and <a href="/pkg/context/#WithTimeoutCause"><code>WithTimeoutCause</code></a>
356       functions provide a way to set a context cancellation cause when a deadline or
357       timer expires. The cause may be retrieved with the
358       <a href="/pkg/context/#Cause"><code>Cause</code></a> function.
359     </p>
360     <p><!-- https://go.dev/issue/57928, CL 482695 -->
361       The new <a href="/pkg/context/#AfterFunc"><code>AfterFunc</code></a>
362       function registers a function to run after a context has been cancelled.
363     </p>
364   </dd>
365 </dl>
366
367 <dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
368   <dd>
369     <p><!-- CL 459977 -->
370       TODO: <a href="https://go.dev/cl/459977">https://go.dev/cl/459977</a>: crypto/elliptic: deprecate unsafe APIs; modified api/next/34648.txt, api/next/52221.txt
371     </p>
372   </dd>
373 </dl><!-- crypto/elliptic -->
374
375 <dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
376   <dd>
377     <p><!-- https://go.dev/issue/56921 -->
378       TODO: <a href="https://go.dev/issue/56921">https://go.dev/issue/56921</a>: deprecate GenerateMultiPrimeKey and PrecomputedValues.CRTValues
379     </p>
380
381     <p><!-- CL 459976 -->
382       TODO: <a href="https://go.dev/cl/459976">https://go.dev/cl/459976</a>: crypto/rsa: deprecate multiprime RSA support; modified api/next/56921.txt
383     </p>
384   </dd>
385 </dl><!-- crypto/rsa -->
386
387 <dl id="crypto/sha1"><dt><a href="/pkg/crypto/sha1/">crypto/sha1</a></dt>
388   <dd>
389     <p><!-- CL 483815 -->
390       TODO: <a href="https://go.dev/cl/483815">https://go.dev/cl/483815</a>: crypto/sha1: add WriteString and WriteByte method
391     </p>
392   </dd>
393 </dl><!-- crypto/sha1 -->
394
395 <dl id="crypto/sha256"><dt><a href="/pkg/crypto/sha256/">crypto/sha256</a></dt>
396   <dd>
397     <p><!-- https://go.dev/issue/50543 -->
398       TODO: <a href="https://go.dev/issue/50543">https://go.dev/issue/50543</a>: add native SHA256 instruction implementation for AMD64
399     </p>
400
401     <p><!-- CL 408795 -->
402       TODO: <a href="https://go.dev/cl/408795">https://go.dev/cl/408795</a>: crypto/sha256: add sha-ni implementation; crypto/sha256 uses Intel SHA extensions on new enough x86 processors, making it 3-4X faster.
403     </p>
404
405     <p><!-- CL 481478 -->
406       TODO: <a href="https://go.dev/cl/481478">https://go.dev/cl/481478</a>: crypto/sha256: add WriteString and WriteByte method
407     </p>
408   </dd>
409 </dl><!-- crypto/sha256 -->
410
411 <dl id="crypto/sha512"><dt><a href="/pkg/crypto/sha512/">crypto/sha512</a></dt>
412   <dd>
413     <p><!-- CL 483816 -->
414       TODO: <a href="https://go.dev/cl/483816">https://go.dev/cl/483816</a>: crypto/sha512: add WriteString and WriteByte method
415     </p>
416   </dd>
417 </dl><!-- crypto/sha512 -->
418
419 <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
420   <dd>
421     <p><!-- https://go.dev/issue/53573 -->
422       TODO: <a href="https://go.dev/issue/53573">https://go.dev/issue/53573</a>: surface ReasonCode inside x509.RevocationList entries
423     </p>
424
425     <p><!-- CL 468875 -->
426       TODO: <a href="https://go.dev/cl/468875">https://go.dev/cl/468875</a>: crypto/x509: surface ReasonCode in RevocationList API; modified api/next/53573.txt
427     </p>
428   </dd>
429 </dl><!-- crypto/x509 -->
430
431 <dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
432   <dd>
433     <p><!-- https://go.dev/issue/56887 -->
434       TODO: <a href="https://go.dev/issue/56887">https://go.dev/issue/56887</a>: add DT_FLAGS_1 (dynamic flags) constants
435     </p>
436
437     <p><!-- https://go.dev/issue/56892 -->
438       TODO: <a href="https://go.dev/issue/56892">https://go.dev/issue/56892</a>: add (*File).DynValue
439     </p>
440
441     <p><!-- CL 452496 -->
442       TODO: <a href="https://go.dev/cl/452496">https://go.dev/cl/452496</a>: debug/elf: add DT_FLAGS_1 constants; modified api/next/56887.txt
443     </p>
444
445     <p><!-- CL 452617 -->
446       TODO: <a href="https://go.dev/cl/452617">https://go.dev/cl/452617</a>: debug/elf: retrieve values for dynamic section tags; modified api/next/56892.txt
447     </p>
448
449     <p><!-- CL 473256 -->
450       TODO: <a href="https://go.dev/cl/473256">https://go.dev/cl/473256</a>: debug/elf: support zstd compression; modified api/next/55107.txt
451     </p>
452   </dd>
453 </dl><!-- debug/elf -->
454
455 <dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
456   <dd>
457     <p><!-- CL 488475 -->
458       Attempts to read from a section containing uninitialized data
459       using
460       <a href="/pkg/debug/pe/#Section.Data"><code>Section.Data</code></a>
461       or the reader returned by <a href="/pkg/debug/pe/#Section.Open"><code>Section.Open</code></a>
462       now return an error.
463     </p>
464   </dd>
465 </dl><!-- debug/pe -->
466
467 <dl id="embed"><dt><a href="/pkg/embed/">embed</a></dt>
468   <dd>
469     <p><!-- https://go.dev/issue/57803, CL 483235 -->
470       The <a href="/pkg/io/fs/#File"><code>io/fs.File</code></a>
471       returned by
472       <a href="/pkg/embed/#FS.Open"><code>FS.Open</code></a> now
473       has a <code>ReadAt</code> method that
474       implements <a href="/pkg/io/#ReaderAt"><code>io.ReaderAt</code></a>.
475     </p>
476
477     <p><!-- https://go.dev/issue/54451, CL 491175 -->
478       Calling <code><a href="/pkg/embed/FS.Open">FS.Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
479       will return a type that now implements a <code>String</code>
480       method that calls
481       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
482     </p>
483   </dd>
484 </dl><!-- embed -->
485
486 <dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
487   <dd>
488     <p><!-- https://go.dev/issue/41198, CL 473935 -->
489       The new
490       <a href="/pkg/errors/#ErrUnsupported"><code>ErrUnsupported</code></a>
491       error provides a standardized way to indicate that a requested
492       operation may not be performed because it is unsupported.
493       For example, a call to
494       <a href="/pkg/os/#Link"><code>os.Link</code></a> when using a
495       file system that does not support hard links.
496     </p>
497   </dd>
498 </dl><!-- errors -->
499
500 <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
501   <dd>
502     <p><!-- https://go.dev/issue/53747, CL 476015 -->
503       The new <a href="/pkg/flag/#BoolFunc"><code>BoolFunc</code></a>
504       function and
505       <a href="/pkg/flag/#FlagSet.BoolFunc"><code>FlagSet.BoolFunc</code></a>
506       method define a flag that does not require an argument and calls
507       a function when the flag is used. This is similar to
508       <a href="/pkg/flag/#Func"><code>Func</code></a> but for a
509       boolean flag.
510     </p>
511
512     <p><!-- CL 480215 -->
513       A flag definition (via <code>Bool</code>, <code>BoolVar</code>, <code>Int</code>, <code>IntVar</code>, etc.) will panic if <code>Set</code> has already been called on a flag with the same name.
514       <p>
515       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 <code>Set</code> operations.
516     </p>
517   </dd>
518 </dl><!-- flag -->
519
520 <dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
521   <dd>
522     <p><!-- https://go.dev/issue/28089, CL 487935 -->
523       The new <a href="/pkg/go/ast/#IsGenerated"><code>IsGenerated</code></a> predicate
524       reports whether a file syntax tree contains the
525       <a href="https://go.dev/s/generatedcode">special comment</a>
526       that conventionally indicates that the file was generated by a tool.
527     </p>
528   </dd>
529
530   <dd>
531     <p><!-- https://go.dev/issue/59033, CL 476276 -->
532       The new
533       <a href="/pkg/go/ast/#File.GoVersion"><code>File.GoVersion</code></a>
534       field records the minimum Go version required by
535       any <code>//go:build</code> or <code>// +build</code>
536       directives.
537     </p>
538   </dd>
539 </dl><!-- go/ast -->
540
541 <dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
542   <dd>
543     <p><!-- https://go.dev/issue/56986, CL 453603 -->
544       The package now parses build directives (comments that start
545       with <code>//go:</code>) in file headers (before
546       the <code>package</code> declaration). These directives are
547       available in the new
548       <a href="/pkg/go/build/Package"><code>Package</code></a> fields
549       <a href="/pkg/go/build/Package.Directives"><code>Directives</code></a>,
550       <a href="/pkg/go/build/Package.TestDirectives"><code>TestDirectives</code></a>,
551       and
552       <a href="/pkg/go/build/Package.XTestDirectives"><code>XTestDirectives</code></a>.
553     </p>
554   </dd>
555 </dl><!-- go/build -->
556
557 <dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
558   <dd>
559     <p><!-- https://go.dev/issue/59033, CL 476275 -->
560       The new
561       <a href="/pkg/go/build/constraint/#GoVersion"><code>GoVersion</code></a>
562       function returns the minimum Go version implied by a build
563       expression.
564     </p>
565   </dd>
566 </dl><!-- go/build/constraint -->
567
568 <dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
569   <dd>
570     <p><!-- https://go.dev/issue/57708, CL 464515 -->
571       The new <a href="/pkg/go/token/#File.Lines"><code>File.Lines</code></a> method
572       returns the file's line-number table in the same form as accepted by
573       <code>File.SetLines</code>.
574     </p>
575   </dd>
576 </dl><!-- go/token -->
577
578 <dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
579   <dd>
580     <p><!-- https://go.dev/issue/47342, CL 468795 -->
581       The <code>hash/maphash</code> package now has a pure Go implementation, selectable with the <code>purego</code> build tag.
582     </p>
583   </dd>
584 </dl><!-- hash/maphash -->
585
586 <dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
587   <dd>
588     <p><!-- https://go.dev/issue/54451, CL 489555 -->
589       The new
590       <a href="/pkg/io/fs/#FormatFileInfo"><code>FormatFileInfo</code></a>
591       function returns a formatted version of a
592       <a href="/pkg/io/fs/#FileInfo"><code>FileInfo</code></a>.
593       The new
594       <a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>
595       function returns a formatted version of a
596       <a href="/pkg/io/fs/#FileInfo"><code>DirEntry</code></a>.
597       The implementation of
598       <a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
599       returned by
600       <a href="/pkg/io/fs/#ReadDir"><code>ReadDir</code></a> now
601       implements a <code>String</code> method that calls
602       <a href="/pkg/io/fs/#FormatDirEntry"><code>FormatDirEntry</code></a>,
603       and the same is true for
604       the <a href="/pkg/io/fs/#DirEntry"><code>DirEntry</code></a>
605       value passed to
606       <a href="/pkg/io/fs/#WalkDirFunc"><code>WalkDirFunc</code></a>.
607     </p>
608   </dd>
609 </dl><!-- io/fs -->
610
611 <dl id="log/slog"><dt><a href="/pkg/log/slog/">log/slog</a></dt>
612   <dd>
613     <p><!-- https://go.dev/issue/59060 -->
614       TODO: <a href="https://go.dev/issue/59060">https://go.dev/issue/59060</a>: arg to Record.Attrs should return bool
615     </p>
616
617     <p><!-- https://go.dev/issue/59141 -->
618       TODO: <a href="https://go.dev/issue/59141">https://go.dev/issue/59141</a>: handle panics in LogValuer.LogValue
619     </p>
620
621     <p><!-- https://go.dev/issue/59204 -->
622       TODO: <a href="https://go.dev/issue/59204">https://go.dev/issue/59204</a>: change slog.Group signature to ...any
623     </p>
624
625     <p><!-- https://go.dev/issue/59280 -->
626       TODO: <a href="https://go.dev/issue/59280">https://go.dev/issue/59280</a>: ReplaceAttr gets Source struct instead of file:line
627     </p>
628
629     <p><!-- https://go.dev/issue/59282 -->
630       TODO: <a href="https://go.dev/issue/59282">https://go.dev/issue/59282</a>: drop only completely empty Attrs
631     </p>
632
633     <p><!-- https://go.dev/issue/59339 -->
634       TODO: <a href="https://go.dev/issue/59339">https://go.dev/issue/59339</a>: change constructors to NewXXXHandler(io.Writer, *HandlerOptions)
635     </p>
636
637     <p><!-- https://go.dev/issue/59345 -->
638       TODO: <a href="https://go.dev/issue/59345">https://go.dev/issue/59345</a>: JSONHandler should format everything like json.Marshal
639     </p>
640
641     <p><!-- CL 477295 -->
642       TODO: <a href="https://go.dev/cl/477295">https://go.dev/cl/477295</a>: log/slog: initial commit; modified api/next/56345.txt
643     </p>
644
645     <p><!-- CL 484096 -->
646       TODO: <a href="https://go.dev/cl/484096">https://go.dev/cl/484096</a>: log/slog: function argument to Record.Attrs returns bool; modified api/next/59060.txt
647     </p>
648
649     <p><!-- CL 486376 -->
650       TODO: <a href="https://go.dev/cl/486376">https://go.dev/cl/486376</a>: log/slog: add Source type for source location; modified api/next/59280.txt
651     </p>
652
653     <p><!-- CL 486415 -->
654       TODO: <a href="https://go.dev/cl/486415">https://go.dev/cl/486415</a>: log/slog: built-in handler constructors take options as a second arg; modified api/next/56345.txt, api/next/59339.txt
655     </p>
656
657     <p><!-- CL 487855 -->
658       TODO: <a href="https://go.dev/cl/487855">https://go.dev/cl/487855</a>: log/slog: Group takes ...any; modified api/next/56345.txt, api/next/59204.txt
659     </p>
660   </dd>
661 </dl><!-- log/slog -->
662
663 <dl id="math"><dt><a href="/pkg/math/">math</a></dt>
664   <dd>
665     <p><!-- https://go.dev/issue/56491 -->
666       TODO: <a href="https://go.dev/issue/56491">https://go.dev/issue/56491</a>: add Compare and Compare32
667     </p>
668
669     <p><!-- CL 459435 -->
670       TODO: <a href="https://go.dev/cl/459435">https://go.dev/cl/459435</a>: math: add Compare and Compare32; modified api/next/56491.txt
671     </p>
672
673     <p><!-- CL 467515 -->
674       TODO: <a href="https://go.dev/cl/467515">https://go.dev/cl/467515</a>: math: add Compare and Compare32; modified api/next/56491.txt
675     </p>
676   </dd>
677 </dl><!-- math -->
678
679 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
680   <dd>
681     <p><!-- https://go.dev/issue/56984, CL 453115 -->
682       The new <a href="/pkg/math/big/#Int.ToFloat64"><code>Int.ToFloat64</code></a>
683       method returns the nearest floating-point value to a
684       multi-precision integer, along with an indication of any
685       rounding that occurred.
686     </p>
687   </dd>
688 </dl><!-- math/big -->
689
690 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
691   <dd>
692     <p>
693       <!-- https://go.dev/issue/59166, https://go.dev/issue/56539 -->
694       <!-- CL 471136, CL 471137, CL 471140 -->
695       On Linux, the <a href="/pkg/net/">net</a> package can now use
696       Multipath TCP when the kernel supports it. It is not used by
697       default. To use Multipath TCP when available on a client, call
698       the
699       <a href="/pkg/net/#Dialer.SetMultipathTCP"><code>Dialer.SetMultipathTCP</code></a>
700       method before calling the
701       <a href="/pkg/net/#Dialer.Dial"><code>Dialer.Dial</code></a> or
702       <a href="/pkg/net/#Dialer.DialContext"><code>Dialer.DialContext</code></a>
703       methods. To use Multipath TCP when available on a server, call
704       the
705       <a href="/pkg/net/#ListenConfig.SetMultipathTCP"><code>ListenConfig.SetMultipathTCP</code></a>
706       method before calling the
707       <a href="/pkg/net/#ListenConfig.Listen"><code>ListenConfig.Listen</code></a>
708       method. Specify the network as <code>"tcp"</code> or
709       <code>"tcp4"</code> or <code>"tcp6"</code> as usual. If
710       Multipath TCP is not supported by the kernel or the remote host,
711       the connection will silently fall back to TCP. To test whether a
712       particular connection is using Multipath TCP, use the
713       <a href="/pkg/net/#TCPConn.MultipathTCP"><code>TCPConn.MultipathTCP</code></a>
714       method.
715     </p>
716     <p>
717       In a future Go release we may enable Multipath TCP by default on
718       systems that support it.
719     </p>
720   </dd>
721 </dl><!-- net -->
722
723 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
724   <dd>
725     <p><!-- https://go.dev/issue/44855, CL 382117 -->
726       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.
727     </p>
728
729     <p><!-- CL 472636 -->
730       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
731     </p>
732
733     <p><!-- CL 494122 -->
734       The <a href="/pkg/net/http/">net/http</a> package now supports
735       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
736       in that the expression
737       <code>errors.Is(http.ErrNotSupported, errors.ErrUnsupported)</code>
738       will return true.
739     </p>
740   </dd>
741 </dl><!-- net/http -->
742
743 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
744   <dd>
745     <p><!-- https://go.dev/issue/32558, CL 219638 -->
746       Programs may now pass an empty <code>time.Time</code> value to
747       the <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> function
748       to leave either the access time or the modification time unchanged.
749     </p>
750
751     <p><!-- CL 480135 -->
752       On Windows the
753       <a href="/pkg/os#File.Chdir"><code>File.Chdir</code></a> method
754       now changes the current directory to the file, rather than
755       always returning an error.
756     </p>
757
758     <p><!-- CL 477215 -->
759       On Windows calling
760       <a href="/pkg/os/#Truncate"><code>Truncate</code></a> on a
761       non-existent file used to create an empty file. It now returns
762       an error indicating that the file does not exist.
763     </p>
764
765     <p><!-- CL 493036 -->
766       On Windows the os package now supports working with files whose
767       names, stored as UTF-16, can't be represented as valid UTF-8.
768     </p>
769
770     <p><!-- https://go.dev/issue/54451, CL 491175 -->
771       The implementation of the
772       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
773       interface returned by the
774       <a href="/pkg/os/#ReadDir"><code>ReadDir</code></a> function and
775       the <a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code>
776       method now implements a <code>String</code> method that calls
777       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
778     </p>
779   </dd>
780 </dl><!-- os -->
781
782 <dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
783   <dd>
784     <p>
785       The implementation of the
786       <a href="/pkg/io/fs/#DirEntry"><code>io/fs.DirEntry</code></a>
787       interface passed to the function argument of
788       <a href="/pkg/path/filepath/#WalkDir"><code>WalkDir</code></a>
789       now implements a <code>String</code> method that calls
790       <a href="/pkg/io/fs/#FormatDirEntry"><code>io/fs.FormatDirEntry</code></a>.
791     </p>
792   </dd>
793 </dl><!-- path/filepath -->
794
795 <!-- CL 459455 reverted -->
796
797 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
798   <dd>
799     <p><!-- CL 408826, CL 413474 -->
800       In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
801       no longer forces its argument to be allocated on the heap, allowing
802       a <code>Value</code>'s content to be allocated on the stack. Most
803       operations on a <code>Value</code> also allow the underlying value
804       to be stack allocated.
805     </p>
806
807     <p><!-- https://go.dev/issue/55002 -->
808       The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
809       method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
810       clears the contents of a map or zeros the contents of a slice.
811       This corresponds to the new <code>clear</code> built-in
812       <a href="#language">added to the language</a>.
813     </p>
814
815     <p><!-- https://go.dev/issue/56906, CL 452762 -->
816       The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
817       and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
818       types are now deprecated. In new code
819       prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
820       <a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
821       <a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
822       or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
823     </p>
824   </dd>
825 </dl><!-- reflect -->
826
827 <dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
828   <dd>
829     <p><!-- https://go.dev/issue/46159, CL 479401 -->
830       <a href="/pkg/regexp#Regexp"><code>Regexp</code></a> now defines
831       <a href="/pkg/regexp#Regexp.MarshalText"><code>MarshalText</code></a>
832       and <a href="/pkg/regexp#Regexp.UnmarshalText"><code>UnmarshalText</code></a>
833       methods. These implement
834       <a href="/pkg/encoding#TextMarshaler"><code>encoding.TextMarshaler</code></a>
835       and
836       <a href="/pkg/encoding#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>
837       and will be used by packages such as
838       <a href="/pkg/encoding/json">encoding/json</a>.
839     </p>
840   </dd>
841 </dl><!-- regexp -->
842
843 <dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
844   <dd>
845     <p><!-- https://go.dev/issue/38651 -->
846       TODO: <a href="https://go.dev/issue/38651">https://go.dev/issue/38651</a>: add &#39;created by goroutine number&#39; to stack traces
847     </p>
848
849     <p><!-- https://go.dev/issue/57441, CL 474915 -->
850       Crashing Go applications can now opt-in to Windows Error Reporting (WER) by setting the environment variable
851       <code>GOTRACEBACK=wer</code> or calling <a href="/pkg/runtime/debug/#SetTraceback"><code>debug.SetTraceback("wer")</code></a>
852       before the crash. Other than enabling WER, the runtime will behave as with <code>GOTRACEBACK=crash</code>.
853       On non-Windows systems, <code>GOTRACEBACK=wer</code> is ignored.
854     </p>
855
856     <p><!-- CL 447778 -->
857       <code>GODEBUG=cgocheck=2</code>, a thorough checker of cgo pointer passing rules,
858       is no longer available as a <a href="/pkg/runtime#hdr-Environment_Variables">debug option</a>.
859       Instead, it is available as an experiment using <code>GOEXPERIMENT=cgocheck2</code>.
860       In particular this means that this mode has to be selected at build time instead of startup time.
861     <p>
862       <code>GODEBUG=cgocheck=1</code> is still available (and is still the default).
863     </p>
864
865     <p><!-- https://go.dev/issue/46787 -->
866       A new type <code>Pinner</code> has been added to the runtime
867       package. <code>Pinner</code>s may be used to "pin" Go memory
868       such that it may be used more freely by non-Go code. For instance,
869       passing Go values that reference pinned Go memory to C code is
870       now allowed. Previously, passing any such nested reference was
871       disallowed by the
872       <a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
873
874       See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
875     </p>
876   </dd>
877 </dl><!-- runtime -->
878
879 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
880   <dd>
881     <p><!-- https://go.dev/issue/16638 -->
882       Collecting traces on amd64 and arm64 now incurs a substantially
883       smaller CPU cost: up to a 10x improvement over the previous release.
884     </p>
885
886     <p><!-- CL 494495 -->
887       Traces now contain explicit stop-the-world events for every reason
888       the Go runtime might stop-the-world, not just garbage collection.
889     </p>
890   </dd>
891 </dl><!-- runtime/trace -->
892
893 <dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
894   <dd>
895     <p><!-- https://go.dev/issue/56857 -->
896       A few previously-internal GC metrics, such as live heap size, are
897       now available.
898
899       <code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
900       available as metrics.
901     </p>
902   </dd>
903 </dl><!-- runtime/metrics -->
904
905 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
906   <dd>
907     <p><!-- https://go.dev/issue/56102, CL 451356 -->
908       The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
909       <a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
910       <a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
911       functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
912       lazily initialize a value on first use.
913     </p>
914   </dd>
915 </dl>
916
917 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
918   <dd>
919     <p><!-- CL 480135 -->
920       On Windows the
921       <a href="/pkg/syscall#Fchdir"><code>Fchdir</code></a> function
922       now changes the current directory to its argument, rather than
923       always returning an error.
924     </p>
925
926     <p><!-- https://go.dev/issue/46259, CL 458335 -->
927       On FreeBSD
928       <a href="/pkg/syscall#SysProcAttr"><code>SysProcAttr</code></a>
929       has a new field <code>Jail</code> that may be used to put the
930       newly created process in a jailed environment.
931     </p>
932
933     <p><!-- CL 493036 -->
934       On Windows the syscall package now supports working with files whose
935       names, stored as UTF-16, can't be represented as valid UTF-8.
936       The <a href="/pkg/syscall#UTF16ToString"><code>UTF16ToString</code></a>
937       and <a href="/pkg/syscall#UTF16FromString"><code>UTF16FromString</code></a>
938       functions now convert between UTF-16 data and
939       <a href=http://simonsapin.github.io/wtf-8/"">WTF-8</a> strings.
940       This is backward compatible as WTF-8 is a superset of the UTF-8
941       format that was used in earlier releases.
942     </p>
943
944     <p><!-- CL 476578, CL 476875, CL 476916 -->
945       Several error values match the new
946       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
947       such that <code>errors.Is(err, errors.ErrUnsupported)</code>
948       returns true.
949       <ul>
950         <li><code>ENOSYS</code></li>
951         <li><code>ENOTSUP</code></li>
952         <li><code>EOPNOTSUPP</code></li>
953         <li><code>EPLAN9</code> (Plan 9 only)</li>
954         <li><code>ERROR_CALL_NOT_IMPLEMENTED</code> (Windows only)</li>
955         <li><code>ERROR_NOT_SUPPORTED</code> (Windows only)</li>
956         <li><code>EWINDOWS</code> (Windows only)</li>
957       </ul>
958     </p>
959   </dd>
960 </dl><!-- syscall -->
961
962 <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
963   <dd>
964     <p><!-- https://go.dev/issue/37708, CL 463837 -->
965       The new <code>-test.fullpath</code> option will print full path
966       names in test log messages, rather than just base names.
967     </p>
968
969     <p><!-- https://go.dev/issue/52600, CL 475496 -->
970       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>.
971     </p>
972   </dd>
973 </dl><!-- testing -->
974
975 <dl id="testing/fstest"><dt><a href="/pkg/testing/fstest/">testing/fstest</a></dt>
976   <dd>
977     <p><!-- https://go.dev/issue/54451, CL 491175 -->
978       Calling <code><a href="/pkg/testing/fstest/MapFS.Open">Open</a>.<a href="/pkg/io/fs/#File.Stat">Stat</a></code>
979       will return a type that now implements a <code>String</code>
980       method that calls
981       <a href="/pkg/io/fs/#FormatFileInfo"><code>io/fs.FormatFileInfo</code></a>.
982     </p>
983   </dd>
984 </dl><!-- testing/fstest -->
985
986 <dl id="testing/slogtest"><dt><a href="/pkg/testing/slogtest/">testing/slogtest</a></dt>
987   <dd>
988     <p><!-- CL 487895 -->
989       TODO: <a href="https://go.dev/cl/487895">https://go.dev/cl/487895</a>: testing/slogtest: tests for slog handlers; modified api/next/56345.txt
990     </p>
991   </dd>
992 </dl><!-- testing/slogtest -->
993
994 <!-- proposals for x repos that don't need to be mentioned here but
995      are picked up by the relnote tool. -->
996 <!-- https://go.dev/issue/54232 -->
997 <!-- https://go.dev/issue/57906 -->
998 <!-- https://go.dev/issue/58668 -->