]> Cypherpunks.ru repositories - gostls13.git/blob - doc/go1.21.html
0be1bdce5f6d780e2deea34c805884a59bf141db
[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 -->
430       TODO: <a href="https://go.dev/issue/41198">https://go.dev/issue/41198</a>: add ErrUnsupported
431     </p>
432
433     <p><!-- CL 473935 -->
434       TODO: <a href="https://go.dev/cl/473935">https://go.dev/cl/473935</a>: errors: add ErrUnsupported; modified api/next/41198.txt
435     </p>
436   </dd>
437 </dl><!-- errors -->
438
439 <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
440   <dd>
441     <p><!-- https://go.dev/issue/53747 -->
442       TODO: <a href="https://go.dev/issue/53747">https://go.dev/issue/53747</a>: add BoolFunc(name, usage string, fn func(string)error)
443     </p>
444
445     <p><!-- CL 476015 -->
446       TODO: <a href="https://go.dev/cl/476015">https://go.dev/cl/476015</a>: flag: add BoolFunc; FlagSet.BoolFunc; modified api/next/53747.txt
447     </p>
448
449     <p><!-- CL 480215 -->
450       TODO: <a href="https://go.dev/cl/480215">https://go.dev/cl/480215</a>: flag: panic if a flag is defined after being set
451     </p>
452   </dd>
453 </dl><!-- flag -->
454
455 <dl id="fs"><dt><a href="/pkg/fs/">fs</a></dt>
456   <dd>
457     <p><!-- https://go.dev/issue/54451 -->
458       TODO: <a href="https://go.dev/issue/54451">https://go.dev/issue/54451</a>: standard implementations of FileInfo and DirEntry should implement fmt.Stringer
459     </p>
460   </dd>
461 </dl><!-- fs -->
462
463 <dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
464   <dd>
465     <p><!-- https://go.dev/issue/28089, CL 487935 -->
466       The new <a href="/pkg/go/ast/#IsGenerated"><code>IsGenerated</code></a> predicate
467       reports whether a file syntax tree contains the
468       <a href="https://go.dev/s/generatedcode">special comment</a>
469       that conventionally indicates that the file was generated by a tool.
470     </p>
471   </dd>
472
473   <dd>
474     <p><!-- CL 476276 -->
475       TODO: <a href="https://go.dev/cl/476276">https://go.dev/cl/476276</a>: go/ast: add File.GoVersion; modified api/next/59033.txt
476     </p>
477   </dd>
478 </dl><!-- go/ast -->
479
480 <dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
481   <dd>
482     <p><!-- CL 453603 -->
483       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
484     </p>
485   </dd>
486 </dl><!-- go/build -->
487
488 <dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
489   <dd>
490     <p><!-- CL 476275 -->
491       TODO: <a href="https://go.dev/cl/476275">https://go.dev/cl/476275</a>: go/build/constraint: add GoVersion; modified api/next/59033.txt
492     </p>
493   </dd>
494 </dl><!-- go/build/constraint -->
495
496 <dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
497   <dd>
498     <p><!-- https://go.dev/issue/57708, CL 464515 -->
499       The new <a href="/pkg/go/token/#File.Lines"><code>File.Lines</code></a> method
500       returns the file's line-number table in the same form as accepted by
501       <code>File.SetLines</code>.
502     </p>
503   </dd>
504 </dl><!-- go/token -->
505
506 <dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
507   <dd>
508     <p><!-- https://go.dev/issue/47342 -->
509       TODO: <a href="https://go.dev/issue/47342">https://go.dev/issue/47342</a>: Provide a `purego` implementation
510     </p>
511
512     <p><!-- CL 468795 -->
513       TODO: <a href="https://go.dev/cl/468795">https://go.dev/cl/468795</a>: hash/maphash: add purego implementation
514     </p>
515   </dd>
516 </dl><!-- hash/maphash -->
517
518 <dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
519   <dd>
520     <p><!-- CL 489555 -->
521       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
522     </p>
523   </dd>
524 </dl><!-- io/fs -->
525
526 <dl id="log/slog"><dt><a href="/pkg/log/slog/">log/slog</a></dt>
527   <dd>
528     <p><!-- https://go.dev/issue/59060 -->
529       TODO: <a href="https://go.dev/issue/59060">https://go.dev/issue/59060</a>: arg to Record.Attrs should return bool
530     </p>
531
532     <p><!-- https://go.dev/issue/59141 -->
533       TODO: <a href="https://go.dev/issue/59141">https://go.dev/issue/59141</a>: handle panics in LogValuer.LogValue
534     </p>
535
536     <p><!-- https://go.dev/issue/59204 -->
537       TODO: <a href="https://go.dev/issue/59204">https://go.dev/issue/59204</a>: change slog.Group signature to ...any
538     </p>
539
540     <p><!-- https://go.dev/issue/59280 -->
541       TODO: <a href="https://go.dev/issue/59280">https://go.dev/issue/59280</a>: ReplaceAttr gets Source struct instead of file:line
542     </p>
543
544     <p><!-- https://go.dev/issue/59282 -->
545       TODO: <a href="https://go.dev/issue/59282">https://go.dev/issue/59282</a>: drop only completely empty Attrs
546     </p>
547
548     <p><!-- https://go.dev/issue/59339 -->
549       TODO: <a href="https://go.dev/issue/59339">https://go.dev/issue/59339</a>: change constructors to NewXXXHandler(io.Writer, *HandlerOptions)
550     </p>
551
552     <p><!-- https://go.dev/issue/59345 -->
553       TODO: <a href="https://go.dev/issue/59345">https://go.dev/issue/59345</a>: JSONHandler should format everything like json.Marshal
554     </p>
555
556     <p><!-- CL 477295 -->
557       TODO: <a href="https://go.dev/cl/477295">https://go.dev/cl/477295</a>: log/slog: initial commit; modified api/next/56345.txt
558     </p>
559
560     <p><!-- CL 484096 -->
561       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
562     </p>
563
564     <p><!-- CL 486376 -->
565       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
566     </p>
567
568     <p><!-- CL 486415 -->
569       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
570     </p>
571
572     <p><!-- CL 487855 -->
573       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
574     </p>
575   </dd>
576 </dl><!-- log/slog -->
577
578 <dl id="math"><dt><a href="/pkg/math/">math</a></dt>
579   <dd>
580     <p><!-- https://go.dev/issue/56491 -->
581       TODO: <a href="https://go.dev/issue/56491">https://go.dev/issue/56491</a>: add Compare and Compare32
582     </p>
583
584     <p><!-- CL 459435 -->
585       TODO: <a href="https://go.dev/cl/459435">https://go.dev/cl/459435</a>: math: add Compare and Compare32; modified api/next/56491.txt
586     </p>
587
588     <p><!-- CL 467515 -->
589       TODO: <a href="https://go.dev/cl/467515">https://go.dev/cl/467515</a>: math: add Compare and Compare32; modified api/next/56491.txt
590     </p>
591   </dd>
592 </dl><!-- math -->
593
594 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
595   <dd>
596     <p><!-- https://go.dev/issue/56984, CL 453115 -->
597       The new <a href="/pkg/math/big/#Int.ToFloat64"><code>Int.ToFloat64</code></a>
598       method returns the nearest floating-point value to a
599       multi-precision integer, along with an indication of any
600       rounding that occurred.
601     </p>
602   </dd>
603 </dl><!-- math/big -->
604
605 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
606   <dd>
607     <p>
608       <!-- https://go.dev/issue/59166, https://go.dev/issue/56539 -->
609       <!-- CL 471136, CL 471137, CL 471140 -->
610       On Linux, the <a href="/pkg/net/">net</a> package can now use
611       Multipath TCP when the kernel supports it. It is not used by
612       default. To use Multipath TCP when available on a client, call
613       the
614       <a href="/pkg/net/#Dialer.SetMultipathTCP"><code>Dialer.SetMultipathTCP</code></a>
615       method before calling the
616       <a href="/pkg/net/#Dialer.Dial"><code>Dialer.Dial</code></a> or
617       <a href="/pkg/net/#Dialer.DialContext"><code>Dialer.DialContext</code></a>
618       methods. To use Multipath TCP when available on a server, call
619       the
620       <a href="/pkg/net/#ListenConfig.SetMultipathTCP"><code>ListenConfig.SetMultipathTCP</code></a>
621       method before calling the
622       <a href="/pkg/net/#ListenConfig.Listen"><code>ListenConfig.Listen</code></a>
623       method. Specify the network as <code>"tcp"</code> or
624       <code>"tcp4"</code> or <code>"tcp6"</code> as usual. If
625       Multipath TCP is not supported by the kernel or the remote host,
626       the connection will silently fall back to TCP. To test whether a
627       particular connection is using Multipath TCP, use the
628       <a href="/pkg/net/#TCPConn.MultipathTCP"><code>TCPConn.MultipathTCP</code></a>
629       method.
630     </p>
631     <p>
632       In a future Go release we may enable Multipath TCP by default on
633       systems that support it.
634     </p>
635   </dd>
636 </dl><!-- net -->
637
638 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
639   <dd>
640     <p><!-- https://go.dev/issue/44855, CL 382117 -->
641       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.
642     </p>
643
644     <p><!-- CL 472636 -->
645       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
646     </p>
647
648     <p><!-- CL 494122 -->
649       TODO: <a href="https://go.dev/cl/494122">https://go.dev/cl/494122</a>: net/http: let ErrNotSupported match errors.ErrUnsupported; modified api/next/41198.txt
650     </p>
651   </dd>
652 </dl><!-- net/http -->
653
654 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
655   <dd>
656     <p><!-- https://go.dev/issue/32558, CL 219638 -->
657       Programs may now pass an empty <code>time.Time</code> value to
658       the <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> function
659       to leave either the access time or the modification time unchanged.
660     </p>
661
662     <p><!-- CL 480135 -->
663       On Windows the
664       <a href="/pkg/os#File.Chdir"><code>File.Chdir></a> method
665       now changes the current directory to the file, rather than
666       always returning an error.
667     </p>
668
669     <p><!-- CL 477215 -->
670       On Windows calling
671       <a href="/pkg/os/#Truncate"><code>Truncate</code></a> on a
672       non-existent file used to create an empty file. It now returns
673       an error indicating that the file does not exist.
674     </p>
675
676     <p><!-- CL 493036 -->
677       On Windows the os package now supports working with files whose
678       names, stored as UTF-16, can't be represented as valid UTF-8.
679     </p>
680   </dd>
681 </dl><!-- os -->
682
683 <!-- CL 459455 reverted -->
684
685 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
686   <dd>
687     <p><!-- CL 408826, CL 413474 -->
688       In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
689       no longer forces its argument to be allocated on the heap, allowing
690       a <code>Value</code>'s content to be allocated on the stack. Most
691       operations on a <code>Value</code> also allow the underlying value
692       to be stack allocated.
693     </p>
694
695     <p><!-- https://go.dev/issue/55002 -->
696       The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
697       method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
698       clears the contents of a map or zeros the contents of a slice.
699       This corresponds to the new <code>clear</code> built-in
700       <a href="#language">added to the language</a>.
701     </p>
702
703     <p><!-- https://go.dev/issue/56906, CL 452762 -->
704       The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
705       and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
706       types are now deprecated. In new code
707       prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
708       <a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
709       <a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
710       or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
711     </p>
712   </dd>
713 </dl><!-- reflect -->
714
715 <dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
716   <dd>
717     <p><!-- https://go.dev/issue/46159, CL 479401 -->
718       <a href="/pkg/regexp#Regexp"><code>Regexp</code></a> now defines
719       <a href="/pkg/regexp#Regexp.MarshalText"><code>MarshalText</code></a>
720       and <a href="/pkg/regexp#Regexp.UnmarshalText"><code>UnmarshalText</code></a>
721       methods. These implement
722       <a href="/pkg/encoding#TextMarshaler"><code>encoding.TextMarshaler</code></a>
723       and
724       <a href="/pkg/encoding#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>
725       and will be used by packages such as
726       <a href="/pkg/encoding/json">encoding/json</a>.
727     </p>
728   </dd>
729 </dl><!-- regexp -->
730
731 <dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
732   <dd>
733     <p><!-- https://go.dev/issue/38651 -->
734       TODO: <a href="https://go.dev/issue/38651">https://go.dev/issue/38651</a>: add &#39;created by goroutine number&#39; to stack traces
735     </p>
736
737     <p><!-- https://go.dev/issue/57441 -->
738       TODO: <a href="https://go.dev/issue/57441">https://go.dev/issue/57441</a>: use WER for GOTRACEBACK=wer on Windows
739     </p>
740
741     <p><!-- CL 447778 -->
742       TODO: <a href="https://go.dev/cl/447778">https://go.dev/cl/447778</a>: runtime: reimplement GODEBUG=cgocheck=2 as a GOEXPERIMENT
743     </p>
744
745     <p><!-- CL 472195 -->
746       TODO: <a href="https://go.dev/cl/472195">https://go.dev/cl/472195</a>: runtime: remove NOFRAME from asmcgocall, systemstack and mcall
747     </p>
748
749     <p><!-- CL 474915 -->
750       TODO: <a href="https://go.dev/cl/474915">https://go.dev/cl/474915</a>: runtime: support GOTRACEBACK=wer on Windows
751     </p>
752
753     <p><!-- https://go.dev/issue/46787 -->
754       A new type <code>Pinner</code> has been added to the runtime
755       package. <code>Pinner</code>s may be used to "pin" Go memory
756       such that it may be used more freely by non-Go code. For instance,
757       passing Go values that reference pinned Go memory to C code is
758       now allowed. Previously, passing any such nested reference was
759       disallowed by the
760       <a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
761
762       See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
763     </p>
764   </dd>
765 </dl><!-- runtime -->
766
767 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
768   <dd>
769     <p><!-- https://go.dev/issue/16638 -->
770       Collecting traces on amd64 and arm64 now incurs a substantially
771       smaller CPU cost: up to a 10x improvement over the previous release.
772     </p>
773
774     <p><!-- CL 494495 -->
775       Traces now contain explicit stop-the-world events for every reason
776       the Go runtime might stop-the-world, not just garbage collection.
777     </p>
778   </dd>
779 </dl><!-- runtime/trace -->
780
781 <dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
782   <dd>
783     <p><!-- https://go.dev/issue/56857 -->
784       A few previously-internal GC metrics, such as live heap size, are
785       now available.
786
787       <code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
788       available as metrics.
789     </p>
790   </dd>
791 </dl><!-- runtime/metrics -->
792
793 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
794   <dd>
795     <p><!-- https://go.dev/issue/56102, CL 451356 -->
796       The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
797       <a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
798       <a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
799       functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
800       lazily initialize a value on first use.
801     </p>
802   </dd>
803 </dl>
804
805 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
806   <dd>
807     <p><!-- CL 480135 -->
808       On Windows the
809       <a href="/pkg/syscall#Fchdir"><code>Fchdir</code></a> function
810       now changes the current directory to its argument, rather than
811       always returning an error.
812     </p>
813
814     <p><!-- https://go.dev/issue/46259, CL 458335 -->
815       On FreeBSD
816       <a href="/pkg/syscall#SysProcAttr"><code>SysProcAttr</code></a>
817       has a new field <code>Jail</code> that may be used to put the
818       newly created process in a jailed environment.
819     </p>
820
821     <p><!-- CL 493036 -->
822       On Windows the syscall package now supports working with files whose
823       names, stored as UTF-16, can't be represented as valid UTF-8.
824       The <a href="/pkg/syscall#UTF16ToString"><code>UTF16ToString</code></a>
825       and <a href="/pkg/syscall#UTF16FromString"><code>UTF16FromString</code></a>
826       functions now convert between UTF-16 data and
827       <a href=http://simonsapin.github.io/wtf-8/"">WTF-8</a> strings.
828       This is backward compatible as WTF-8 is a superset of the UTF-8
829       format that was used in earlier releases.
830     </p>
831   </dd>
832 </dl><!-- syscall -->
833
834 <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
835   <dd>
836     <p><!-- https://go.dev/issue/37708, CL 463837 -->
837       The new <code>-test.fullpath</code> option will print full path
838       names in test log messages, rather than just base names.
839     </p>
840
841     <p><!-- https://go.dev/issue/52600, CL 475496 -->
842       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>.
843     </p>
844   </dd>
845 </dl><!-- testing -->
846
847 <dl id="testing/slogtest"><dt><a href="/pkg/testing/slogtest/">testing/slogtest</a></dt>
848   <dd>
849     <p><!-- CL 487895 -->
850       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
851     </p>
852   </dd>
853 </dl><!-- testing/slogtest -->
854
855 <!-- proposals for x repos that don't need to be mentioned here but
856      are picked up by the relnote tool. -->
857 <!-- https://go.dev/issue/54232 -->
858 <!-- https://go.dev/issue/57906 -->
859 <!-- https://go.dev/issue/58668 -->