]> Cypherpunks.ru repositories - gostls13.git/blob - doc/go1.21.html
doc/go1.21: fix HTML tag
[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 <p><!-- CL 453603 -->
166   TODO: <a href="https://go.dev/cl/453603">https://go.dev/cl/453603</a>: cmd/go, go/build: parse directives in file headers; modified api/next/56986.txt
167 </p>
168
169 <!-- CL 466397 -->
170 <p>
171   <!-- cmd/go: make go test build multiple executables; The go test command now supports using the -c flag with multiple packages. -->
172 </p>
173
174 <h2 id="runtime-changes">Runtime</h2>
175
176 <p>
177   TODO: complete this section, or delete if not needed
178 </p>
179
180 <p><!-- https://go.dev/issue/7181 -->
181   When printing very deep stacks, the runtime now prints the first 50
182   (innermost) frames followed by the bottom 50 (outermost) frames,
183   rather than just printing the first 100 frames. This makes it easier
184   to see how deeply recursive stacks started, and is especially
185   valuable for debugging stack overflows.
186 </p>
187
188 <p><!-- https://go.dev/issue/59960 -->
189   On Linux platforms that support transparent huge pages, the Go runtime
190   now manages which parts of the heap may be backed by huge pages more
191   explicitly. This leads to better utilization of memory: small heaps
192   should see less memory used (up to 50% in pathological cases) while
193   large heaps should see fewer broken huge pages for dense parts of the
194   heap, improving CPU usage and latency by up to 1%.
195 </p>
196
197 <p><!-- https://go.dev/issue/57069, https://go.dev/issue/56966 -->
198   As a result of runtime-internal garbage collection tuning,
199   applications may see up to a 40% reduction in application tail latency
200   and a small decrease in memory use. Some applications may also observe
201   a small loss in throughput.
202
203   The memory use decrease should be proportional to the loss in
204   throughput, such that the previous release's throughput/memory
205   tradeoff may be recovered (with little change to latency) by
206   increasing <code>GOGC</code> and/or <code>GOMEMLIMIT</code> slightly.
207 </p>
208
209 <h2 id="compiler">Compiler</h2>
210
211 <!-- CL 490819 -->
212 <p>
213   <!-- cmd/cgo: reject attempts to declare methods on C types -->
214 </p>
215
216 <!-- CL 461315 -->
217 <p>
218   <!-- cmd/compile: enable deadcode of unreferenced large global maps -->
219 </p>
220
221 <p>
222   TODO: complete this section, or delete if not needed
223 </p>
224
225 <h2 id="linker">Linker</h2>
226
227 <!-- CL 457455 -->
228 <p>
229   <!-- cmd/link: generate .xdata PE section -->
230 </p>
231 <!-- CL 463395 -->
232 <p>
233   In Go 1.21 the linker (with help from the compiler) is now capable of
234   deleting dead (unreferenced) global map variables, if the number of
235   entries in the variable initializer is sufficiently large, and if the
236   initializer expressions are side-effect free.
237 </p>
238 <p>
239   TODO: complete this section, or delete if not needed
240 </p>
241
242 <h2 id="library">Core library</h2>
243
244 <h3 id="slog">New log/slog package</h3>
245
246 <p>
247   The new <a href="/pkg/log/slog">log/slog</a> package provides structured logging with levels.
248   Structured logging emits key-value pairs
249   to enable fast, accurate processing of large amounts of log data.
250   The package supports integration with popular log analysis tools and services.
251 </p>
252
253 <h3 id="slices">New slices package</h3>
254
255 <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 -->
256   The new <a href="/pkg/slices">slices</a> package provides many common
257   operations on slices, using generic functions that work with slices
258   of any element type.
259 </p>
260
261 <h3 id="maps">New maps package</h3>
262
263 <p><!-- https://go.dev/issue/57436, CL 464343 -->
264   The new <a href="/pkg/maps/">maps</a> package provides several
265   common operations on maps, using generic functions that work with
266   maps of any key or element type.
267 </p>
268
269 <h3 id="minor_library_changes">Minor changes to the library</h3>
270
271 <p>
272   As always, there are various minor changes and updates to the library,
273   made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
274   in mind.
275   There are also various performance improvements, not enumerated here.
276 </p>
277
278 <p><!-- CL 456837 -->
279   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
280 </p>
281
282 <p>
283   TODO: complete this section
284 </p>
285
286 <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
287   <dd>
288     <p><!-- https://go.dev/issue/53685 -->
289       TODO: <a href="https://go.dev/issue/53685">https://go.dev/issue/53685</a>: add Buffer.Available and Buffer.AvailableBuffer
290     </p>
291
292     <p><!-- CL 474635 -->
293       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
294     </p>
295   </dd>
296 </dl><!-- bytes -->
297
298 <dl id="context"><dt><a href="/pkg/context/">context</a></dt>
299   <dd>
300     <p><!-- https://go.dev/issue/40221, CL 479918 -->
301       The new <a href="/pkg/context/#WithoutCancel"><code>WithoutCancel</code></a>
302       function returns a copy of a context that is not canceled when the original
303       context is canceled.
304     </p>
305     <p><!-- https://go.dev/issue/56661, CL 449318 -->
306       The new <a href="/pkg/context/#WithDeadlineCause"><code>WithDeadlineCause</code></a>
307       and <a href="/pkg/context/#WithTimeoutCause"><code>WithTimeoutCause</code></a>
308       functions provide a way to set a context cancellation cause when a deadline or
309       timer expires. The cause may be retrieved with the
310       <a href="/pkg/context/#Cause"><code>Cause</code></a> function.
311     </p>
312     <p><!-- https://go.dev/issue/57928, CL 482695 -->
313       The new <a href="/pkg/context/#AfterFunc"><code>AfterFunc</code></a>
314       function registers a function to run after a context has been cancelled.
315     </p>
316   </dd>
317 </dl>
318
319 <dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
320   <dd>
321     <p><!-- CL 459977 -->
322       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
323     </p>
324   </dd>
325 </dl><!-- crypto/elliptic -->
326
327 <dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
328   <dd>
329     <p><!-- https://go.dev/issue/56921 -->
330       TODO: <a href="https://go.dev/issue/56921">https://go.dev/issue/56921</a>: deprecate GenerateMultiPrimeKey and PrecomputedValues.CRTValues
331     </p>
332
333     <p><!-- CL 459976 -->
334       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
335     </p>
336   </dd>
337 </dl><!-- crypto/rsa -->
338
339 <dl id="crypto/sha1"><dt><a href="/pkg/crypto/sha1/">crypto/sha1</a></dt>
340   <dd>
341     <p><!-- CL 483815 -->
342       TODO: <a href="https://go.dev/cl/483815">https://go.dev/cl/483815</a>: crypto/sha1: add WriteString and WriteByte method
343     </p>
344   </dd>
345 </dl><!-- crypto/sha1 -->
346
347 <dl id="crypto/sha256"><dt><a href="/pkg/crypto/sha256/">crypto/sha256</a></dt>
348   <dd>
349     <p><!-- https://go.dev/issue/50543 -->
350       TODO: <a href="https://go.dev/issue/50543">https://go.dev/issue/50543</a>: add native SHA256 instruction implementation for AMD64
351     </p>
352
353     <p><!-- CL 408795 -->
354       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.
355     </p>
356
357     <p><!-- CL 481478 -->
358       TODO: <a href="https://go.dev/cl/481478">https://go.dev/cl/481478</a>: crypto/sha256: add WriteString and WriteByte method
359     </p>
360   </dd>
361 </dl><!-- crypto/sha256 -->
362
363 <dl id="crypto/sha512"><dt><a href="/pkg/crypto/sha512/">crypto/sha512</a></dt>
364   <dd>
365     <p><!-- CL 483816 -->
366       TODO: <a href="https://go.dev/cl/483816">https://go.dev/cl/483816</a>: crypto/sha512: add WriteString and WriteByte method
367     </p>
368   </dd>
369 </dl><!-- crypto/sha512 -->
370
371 <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
372   <dd>
373     <p><!-- https://go.dev/issue/53573 -->
374       TODO: <a href="https://go.dev/issue/53573">https://go.dev/issue/53573</a>: surface ReasonCode inside x509.RevocationList entries
375     </p>
376
377     <p><!-- CL 468875 -->
378       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
379     </p>
380   </dd>
381 </dl><!-- crypto/x509 -->
382
383 <dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
384   <dd>
385     <p><!-- https://go.dev/issue/56887 -->
386       TODO: <a href="https://go.dev/issue/56887">https://go.dev/issue/56887</a>: add DT_FLAGS_1 (dynamic flags) constants
387     </p>
388
389     <p><!-- https://go.dev/issue/56892 -->
390       TODO: <a href="https://go.dev/issue/56892">https://go.dev/issue/56892</a>: add (*File).DynValue
391     </p>
392
393     <p><!-- CL 452496 -->
394       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
395     </p>
396
397     <p><!-- CL 452617 -->
398       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
399     </p>
400
401     <p><!-- CL 473256 -->
402       TODO: <a href="https://go.dev/cl/473256">https://go.dev/cl/473256</a>: debug/elf: support zstd compression; modified api/next/55107.txt
403     </p>
404   </dd>
405 </dl><!-- debug/elf -->
406
407 <dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
408   <dd>
409     <p><!-- CL 488475 -->
410       TODO: <a href="https://go.dev/cl/488475">https://go.dev/cl/488475</a>: debug/pe: return error on reading from section with uninitialized data
411     </p>
412   </dd>
413 </dl><!-- debug/pe -->
414
415 <dl id="embed"><dt><a href="/pkg/embed/">embed</a></dt>
416   <dd>
417     <p><!-- https://go.dev/issue/57803 -->
418       TODO: <a href="https://go.dev/issue/57803">https://go.dev/issue/57803</a>: openFile should implement ReaderAt
419     </p>
420
421     <p><!-- CL 483235 -->
422       TODO: <a href="https://go.dev/cl/483235">https://go.dev/cl/483235</a>: embed: implement openFile.ReadAt
423     </p>
424   </dd>
425 </dl><!-- embed -->
426
427 <dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
428   <dd>
429     <p><!-- https://go.dev/issue/41198, CL 473935 -->
430       The new
431       <a href="/pkg/errors/#ErrUnsupported"><code>ErrUnsupported</code></a>
432       error provides a standardized way to indicate that a requested
433       operation may not be performed because it is unsupported.
434       For example, a call to
435       <a href="/pkg/os/#Link"><code>os.Link</code></a> when using a
436       file system that does not support hard links.
437     </p>
438   </dd>
439 </dl><!-- errors -->
440
441 <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
442   <dd>
443     <p><!-- https://go.dev/issue/53747 -->
444       TODO: <a href="https://go.dev/issue/53747">https://go.dev/issue/53747</a>: add BoolFunc(name, usage string, fn func(string)error)
445     </p>
446
447     <p><!-- CL 476015 -->
448       TODO: <a href="https://go.dev/cl/476015">https://go.dev/cl/476015</a>: flag: add BoolFunc; FlagSet.BoolFunc; modified api/next/53747.txt
449     </p>
450
451     <p><!-- CL 480215 -->
452       TODO: <a href="https://go.dev/cl/480215">https://go.dev/cl/480215</a>: flag: panic if a flag is defined after being set
453     </p>
454   </dd>
455 </dl><!-- flag -->
456
457 <dl id="fs"><dt><a href="/pkg/fs/">fs</a></dt>
458   <dd>
459     <p><!-- https://go.dev/issue/54451 -->
460       TODO: <a href="https://go.dev/issue/54451">https://go.dev/issue/54451</a>: standard implementations of FileInfo and DirEntry should implement fmt.Stringer
461     </p>
462   </dd>
463 </dl><!-- fs -->
464
465 <dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
466   <dd>
467     <p><!-- https://go.dev/issue/28089, CL 487935 -->
468       The new <a href="/pkg/go/ast/#IsGenerated"><code>IsGenerated</code></a> predicate
469       reports whether a file syntax tree contains the
470       <a href="https://go.dev/s/generatedcode">special comment</a>
471       that conventionally indicates that the file was generated by a tool.
472     </p>
473   </dd>
474
475   <dd>
476     <p><!-- CL 476276 -->
477       TODO: <a href="https://go.dev/cl/476276">https://go.dev/cl/476276</a>: go/ast: add File.GoVersion; modified api/next/59033.txt
478     </p>
479   </dd>
480 </dl><!-- go/ast -->
481
482 <dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
483   <dd>
484     <p><!-- CL 453603 -->
485       TODO: <a href="https://go.dev/cl/453603">https://go.dev/cl/453603</a>: cmd/go, go/build: parse directives in file headers; modified api/next/56986.txt
486     </p>
487   </dd>
488 </dl><!-- go/build -->
489
490 <dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
491   <dd>
492     <p><!-- CL 476275 -->
493       TODO: <a href="https://go.dev/cl/476275">https://go.dev/cl/476275</a>: go/build/constraint: add GoVersion; modified api/next/59033.txt
494     </p>
495   </dd>
496 </dl><!-- go/build/constraint -->
497
498 <dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
499   <dd>
500     <p><!-- https://go.dev/issue/57708, CL 464515 -->
501       The new <a href="/pkg/go/token/#File.Lines"><code>File.Lines</code></a> method
502       returns the file's line-number table in the same form as accepted by
503       <code>File.SetLines</code>.
504     </p>
505   </dd>
506 </dl><!-- go/token -->
507
508 <dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
509   <dd>
510     <p><!-- https://go.dev/issue/47342 -->
511       TODO: <a href="https://go.dev/issue/47342">https://go.dev/issue/47342</a>: Provide a `purego` implementation
512     </p>
513
514     <p><!-- CL 468795 -->
515       TODO: <a href="https://go.dev/cl/468795">https://go.dev/cl/468795</a>: hash/maphash: add purego implementation
516     </p>
517   </dd>
518 </dl><!-- hash/maphash -->
519
520 <dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
521   <dd>
522     <p><!-- CL 489555 -->
523       TODO: <a href="https://go.dev/cl/489555">https://go.dev/cl/489555</a>: io/fs: add FormatFileInfo and FormatDirEntry functions; modified api/next/54451.txt
524     </p>
525   </dd>
526 </dl><!-- io/fs -->
527
528 <dl id="log/slog"><dt><a href="/pkg/log/slog/">log/slog</a></dt>
529   <dd>
530     <p><!-- https://go.dev/issue/59060 -->
531       TODO: <a href="https://go.dev/issue/59060">https://go.dev/issue/59060</a>: arg to Record.Attrs should return bool
532     </p>
533
534     <p><!-- https://go.dev/issue/59141 -->
535       TODO: <a href="https://go.dev/issue/59141">https://go.dev/issue/59141</a>: handle panics in LogValuer.LogValue
536     </p>
537
538     <p><!-- https://go.dev/issue/59204 -->
539       TODO: <a href="https://go.dev/issue/59204">https://go.dev/issue/59204</a>: change slog.Group signature to ...any
540     </p>
541
542     <p><!-- https://go.dev/issue/59280 -->
543       TODO: <a href="https://go.dev/issue/59280">https://go.dev/issue/59280</a>: ReplaceAttr gets Source struct instead of file:line
544     </p>
545
546     <p><!-- https://go.dev/issue/59282 -->
547       TODO: <a href="https://go.dev/issue/59282">https://go.dev/issue/59282</a>: drop only completely empty Attrs
548     </p>
549
550     <p><!-- https://go.dev/issue/59339 -->
551       TODO: <a href="https://go.dev/issue/59339">https://go.dev/issue/59339</a>: change constructors to NewXXXHandler(io.Writer, *HandlerOptions)
552     </p>
553
554     <p><!-- https://go.dev/issue/59345 -->
555       TODO: <a href="https://go.dev/issue/59345">https://go.dev/issue/59345</a>: JSONHandler should format everything like json.Marshal
556     </p>
557
558     <p><!-- CL 477295 -->
559       TODO: <a href="https://go.dev/cl/477295">https://go.dev/cl/477295</a>: log/slog: initial commit; modified api/next/56345.txt
560     </p>
561
562     <p><!-- CL 484096 -->
563       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
564     </p>
565
566     <p><!-- CL 486376 -->
567       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
568     </p>
569
570     <p><!-- CL 486415 -->
571       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
572     </p>
573
574     <p><!-- CL 487855 -->
575       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
576     </p>
577   </dd>
578 </dl><!-- log/slog -->
579
580 <dl id="math"><dt><a href="/pkg/math/">math</a></dt>
581   <dd>
582     <p><!-- https://go.dev/issue/56491 -->
583       TODO: <a href="https://go.dev/issue/56491">https://go.dev/issue/56491</a>: add Compare and Compare32
584     </p>
585
586     <p><!-- CL 459435 -->
587       TODO: <a href="https://go.dev/cl/459435">https://go.dev/cl/459435</a>: math: add Compare and Compare32; modified api/next/56491.txt
588     </p>
589
590     <p><!-- CL 467515 -->
591       TODO: <a href="https://go.dev/cl/467515">https://go.dev/cl/467515</a>: math: add Compare and Compare32; modified api/next/56491.txt
592     </p>
593   </dd>
594 </dl><!-- math -->
595
596 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
597   <dd>
598     <p><!-- https://go.dev/issue/56984, CL 453115 -->
599       The new <a href="/pkg/math/big/#Int.ToFloat64"><code>Int.ToFloat64</code></a>
600       method returns the nearest floating-point value to a
601       multi-precision integer, along with an indication of any
602       rounding that occurred.
603     </p>
604   </dd>
605 </dl><!-- math/big -->
606
607 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
608   <dd>
609     <p>
610       <!-- https://go.dev/issue/59166, https://go.dev/issue/56539 -->
611       <!-- CL 471136, CL 471137, CL 471140 -->
612       On Linux, the <a href="/pkg/net/">net</a> package can now use
613       Multipath TCP when the kernel supports it. It is not used by
614       default. To use Multipath TCP when available on a client, call
615       the
616       <a href="/pkg/net/#Dialer.SetMultipathTCP"><code>Dialer.SetMultipathTCP</code></a>
617       method before calling the
618       <a href="/pkg/net/#Dialer.Dial"><code>Dialer.Dial</code></a> or
619       <a href="/pkg/net/#Dialer.DialContext"><code>Dialer.DialContext</code></a>
620       methods. To use Multipath TCP when available on a server, call
621       the
622       <a href="/pkg/net/#ListenConfig.SetMultipathTCP"><code>ListenConfig.SetMultipathTCP</code></a>
623       method before calling the
624       <a href="/pkg/net/#ListenConfig.Listen"><code>ListenConfig.Listen</code></a>
625       method. Specify the network as <code>"tcp"</code> or
626       <code>"tcp4"</code> or <code>"tcp6"</code> as usual. If
627       Multipath TCP is not supported by the kernel or the remote host,
628       the connection will silently fall back to TCP. To test whether a
629       particular connection is using Multipath TCP, use the
630       <a href="/pkg/net/#TCPConn.MultipathTCP"><code>TCPConn.MultipathTCP</code></a>
631       method.
632     </p>
633     <p>
634       In a future Go release we may enable Multipath TCP by default on
635       systems that support it.
636     </p>
637   </dd>
638 </dl><!-- net -->
639
640 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
641   <dd>
642     <p><!-- https://go.dev/issue/44855, CL 382117 -->
643       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.
644     </p>
645
646     <p><!-- CL 472636 -->
647       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
648     </p>
649
650     <p><!-- CL 494122 -->
651       The <a href="/pkg/net/http/">net/http</a> package now supports
652       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
653       in that the expression
654       <code>errors.Is(http.ErrNotSupported, errors.ErrUnsupported)</code>
655       will return true.
656     </p>
657   </dd>
658 </dl><!-- net/http -->
659
660 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
661   <dd>
662     <p><!-- https://go.dev/issue/32558, CL 219638 -->
663       Programs may now pass an empty <code>time.Time</code> value to
664       the <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> function
665       to leave either the access time or the modification time unchanged.
666     </p>
667
668     <p><!-- CL 480135 -->
669       On Windows the
670       <a href="/pkg/os#File.Chdir"><code>File.Chdir</code></a> method
671       now changes the current directory to the file, rather than
672       always returning an error.
673     </p>
674
675     <p><!-- CL 477215 -->
676       On Windows calling
677       <a href="/pkg/os/#Truncate"><code>Truncate</code></a> on a
678       non-existent file used to create an empty file. It now returns
679       an error indicating that the file does not exist.
680     </p>
681
682     <p><!-- CL 493036 -->
683       On Windows the os package now supports working with files whose
684       names, stored as UTF-16, can't be represented as valid UTF-8.
685     </p>
686   </dd>
687 </dl><!-- os -->
688
689 <!-- CL 459455 reverted -->
690
691 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
692   <dd>
693     <p><!-- CL 408826, CL 413474 -->
694       In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
695       no longer forces its argument to be allocated on the heap, allowing
696       a <code>Value</code>'s content to be allocated on the stack. Most
697       operations on a <code>Value</code> also allow the underlying value
698       to be stack allocated.
699     </p>
700
701     <p><!-- https://go.dev/issue/55002 -->
702       The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
703       method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
704       clears the contents of a map or zeros the contents of a slice.
705       This corresponds to the new <code>clear</code> built-in
706       <a href="#language">added to the language</a>.
707     </p>
708
709     <p><!-- https://go.dev/issue/56906, CL 452762 -->
710       The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
711       and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
712       types are now deprecated. In new code
713       prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
714       <a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
715       <a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
716       or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
717     </p>
718   </dd>
719 </dl><!-- reflect -->
720
721 <dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
722   <dd>
723     <p><!-- https://go.dev/issue/46159, CL 479401 -->
724       <a href="/pkg/regexp#Regexp"><code>Regexp</code></a> now defines
725       <a href="/pkg/regexp#Regexp.MarshalText"><code>MarshalText</code></a>
726       and <a href="/pkg/regexp#Regexp.UnmarshalText"><code>UnmarshalText</code></a>
727       methods. These implement
728       <a href="/pkg/encoding#TextMarshaler"><code>encoding.TextMarshaler</code></a>
729       and
730       <a href="/pkg/encoding#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>
731       and will be used by packages such as
732       <a href="/pkg/encoding/json">encoding/json</a>.
733     </p>
734   </dd>
735 </dl><!-- regexp -->
736
737 <dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
738   <dd>
739     <p><!-- https://go.dev/issue/38651 -->
740       TODO: <a href="https://go.dev/issue/38651">https://go.dev/issue/38651</a>: add &#39;created by goroutine number&#39; to stack traces
741     </p>
742
743     <p><!-- https://go.dev/issue/57441 -->
744       TODO: <a href="https://go.dev/issue/57441">https://go.dev/issue/57441</a>: use WER for GOTRACEBACK=wer on Windows
745     </p>
746
747     <p><!-- CL 447778 -->
748       TODO: <a href="https://go.dev/cl/447778">https://go.dev/cl/447778</a>: runtime: reimplement GODEBUG=cgocheck=2 as a GOEXPERIMENT
749     </p>
750
751     <p><!-- CL 472195 -->
752       TODO: <a href="https://go.dev/cl/472195">https://go.dev/cl/472195</a>: runtime: remove NOFRAME from asmcgocall, systemstack and mcall
753     </p>
754
755     <p><!-- CL 474915 -->
756       TODO: <a href="https://go.dev/cl/474915">https://go.dev/cl/474915</a>: runtime: support GOTRACEBACK=wer on Windows
757     </p>
758
759     <p><!-- https://go.dev/issue/46787 -->
760       A new type <code>Pinner</code> has been added to the runtime
761       package. <code>Pinner</code>s may be used to "pin" Go memory
762       such that it may be used more freely by non-Go code. For instance,
763       passing Go values that reference pinned Go memory to C code is
764       now allowed. Previously, passing any such nested reference was
765       disallowed by the
766       <a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
767
768       See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
769     </p>
770   </dd>
771 </dl><!-- runtime -->
772
773 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
774   <dd>
775     <p><!-- https://go.dev/issue/16638 -->
776       Collecting traces on amd64 and arm64 now incurs a substantially
777       smaller CPU cost: up to a 10x improvement over the previous release.
778     </p>
779
780     <p><!-- CL 494495 -->
781       Traces now contain explicit stop-the-world events for every reason
782       the Go runtime might stop-the-world, not just garbage collection.
783     </p>
784   </dd>
785 </dl><!-- runtime/trace -->
786
787 <dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
788   <dd>
789     <p><!-- https://go.dev/issue/56857 -->
790       A few previously-internal GC metrics, such as live heap size, are
791       now available.
792
793       <code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
794       available as metrics.
795     </p>
796   </dd>
797 </dl><!-- runtime/metrics -->
798
799 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
800   <dd>
801     <p><!-- https://go.dev/issue/56102, CL 451356 -->
802       The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
803       <a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
804       <a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
805       functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
806       lazily initialize a value on first use.
807     </p>
808   </dd>
809 </dl>
810
811 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
812   <dd>
813     <p><!-- CL 480135 -->
814       On Windows the
815       <a href="/pkg/syscall#Fchdir"><code>Fchdir</code></a> function
816       now changes the current directory to its argument, rather than
817       always returning an error.
818     </p>
819
820     <p><!-- https://go.dev/issue/46259, CL 458335 -->
821       On FreeBSD
822       <a href="/pkg/syscall#SysProcAttr"><code>SysProcAttr</code></a>
823       has a new field <code>Jail</code> that may be used to put the
824       newly created process in a jailed environment.
825     </p>
826
827     <p><!-- CL 493036 -->
828       On Windows the syscall package now supports working with files whose
829       names, stored as UTF-16, can't be represented as valid UTF-8.
830       The <a href="/pkg/syscall#UTF16ToString"><code>UTF16ToString</code></a>
831       and <a href="/pkg/syscall#UTF16FromString"><code>UTF16FromString</code></a>
832       functions now convert between UTF-16 data and
833       <a href=http://simonsapin.github.io/wtf-8/"">WTF-8</a> strings.
834       This is backward compatible as WTF-8 is a superset of the UTF-8
835       format that was used in earlier releases.
836     </p>
837
838     <p><!-- CL 476578, CL 476875, CL 476916 -->
839       Several error values match the new
840       <a href="/pkg/errors/#ErrUnsupported"><code>errors.ErrUnsupported</code></a>,
841       such that <code>errors.Is(err, errors.ErrUnsupported)</code>
842       returns true.
843       <ul>
844         <li><code>ENOSYS</code></li>
845         <li><code>ENOTSUP</code></li>
846         <li><code>EOPNOTSUPP</code></li>
847         <li><code>EPLAN9</code> (Plan 9 only)</li>
848         <li><code>ERROR_CALL_NOT_IMPLEMENTED</code> (Windows only)</li>
849         <li><code>ERROR_NOT_SUPPORTED</code> (Windows only)</li>
850         <li><code>EWINDOWS</code> (Windows only)</li>
851       </ul>
852     </p>
853   </dd>
854 </dl><!-- syscall -->
855
856 <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
857   <dd>
858     <p><!-- https://go.dev/issue/37708, CL 463837 -->
859       The new <code>-test.fullpath</code> option will print full path
860       names in test log messages, rather than just base names.
861     </p>
862
863     <p><!-- https://go.dev/issue/52600, CL 475496 -->
864       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>.
865     </p>
866   </dd>
867 </dl><!-- testing -->
868
869 <dl id="testing/slogtest"><dt><a href="/pkg/testing/slogtest/">testing/slogtest</a></dt>
870   <dd>
871     <p><!-- CL 487895 -->
872       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
873     </p>
874   </dd>
875 </dl><!-- testing/slogtest -->
876
877 <!-- proposals for x repos that don't need to be mentioned here but
878      are picked up by the relnote tool. -->
879 <!-- https://go.dev/issue/54232 -->
880 <!-- https://go.dev/issue/57906 -->
881 <!-- https://go.dev/issue/58668 -->