2 "Title": "Go 1.21 Release Notes",
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.
14 main ul li { margin: 0.5em 0; }
17 <h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.21</h2>
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.
26 <h2 id="language">Changes to the language</h2>
29 Go 1.21 adds three new built-ins to the language.
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
36 See the language spec for
37 <a href="https://tip.golang.org/ref/spec#Min_and_max">details</a>.
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>.
48 <p><!-- https://go.dev/issue/57411 -->
49 Package initialization order is now specified more precisely. The
53 Sort all packages by import path.
55 <li>Repeat until the list of packages is empty:
58 Find the first package in the list for which all imports are
62 Initialize that package and remove it from the list.
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.
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)
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
81 <!-- https://go.dev/issue/57969 -->
83 <!-- add GOEXPERIMENT=loopvar -->
88 TODO: complete this section
91 <h2 id="ports">Ports</h2>
95 <!-- cmd/dist: default to GOARM=7 on all non-arm systems -->
98 <!-- https://go.dev/issue/38248 -->
100 <!-- replace CallImport with go:wasmimport directive -->
103 <h3 id="wasm">WebAssembly</h3>
105 <!-- https://go.dev/issue/59149 -->
107 <!-- allow the use of go:wasmimport globally -->
112 <!-- cmd/compile: remove go:wasmimport restriction -->
115 <!-- https://go.dev/issue/56100 -->
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.
123 <h3 id="wasip1">WebAssembly System Interface</h3>
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>).
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
137 If you have existing filenames matching that pattern, you will
141 <h2 id="tools">Tools</h2>
143 <!-- https://go.dev/issue/15513 -->
145 <!-- support compiling all tests without running -->
148 <h3 id="go-command">Go command</h3>
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
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.
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
171 <!-- cmd/go: make go test build multiple executables; The go test command now supports using the -c flag with multiple packages. -->
174 <h2 id="runtime-changes">Runtime</h2>
177 TODO: complete this section, or delete if not needed
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.
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%.
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.
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.
209 <h2 id="compiler">Compiler</h2>
213 <!-- cmd/cgo: reject attempts to declare methods on C types -->
218 <!-- cmd/compile: enable deadcode of unreferenced large global maps -->
222 TODO: complete this section, or delete if not needed
225 <h2 id="linker">Linker</h2>
229 <!-- cmd/link: generate .xdata PE section -->
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.
239 TODO: complete this section, or delete if not needed
242 <h2 id="library">Core library</h2>
244 <h3 id="slog">New log/slog package</h3>
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.
253 <h3 id="slices">New slices package</h3>
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
261 <h3 id="maps">New maps package</h3>
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.
269 <h3 id="minor_library_changes">Minor changes to the library</h3>
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>
275 There are also various performance improvements, not enumerated here.
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
283 TODO: complete this section
286 <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
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
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
298 <dl id="context"><dt><a href="/pkg/context/">context</a></dt>
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
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.
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.
319 <dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
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
325 </dl><!-- crypto/elliptic -->
327 <dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
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
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
337 </dl><!-- crypto/rsa -->
339 <dl id="crypto/sha1"><dt><a href="/pkg/crypto/sha1/">crypto/sha1</a></dt>
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
345 </dl><!-- crypto/sha1 -->
347 <dl id="crypto/sha256"><dt><a href="/pkg/crypto/sha256/">crypto/sha256</a></dt>
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
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.
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
361 </dl><!-- crypto/sha256 -->
363 <dl id="crypto/sha512"><dt><a href="/pkg/crypto/sha512/">crypto/sha512</a></dt>
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
369 </dl><!-- crypto/sha512 -->
371 <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
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
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
381 </dl><!-- crypto/x509 -->
383 <dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
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
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
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
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
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
405 </dl><!-- debug/elf -->
407 <dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
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
413 </dl><!-- debug/pe -->
415 <dl id="embed"><dt><a href="/pkg/embed/">embed</a></dt>
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
421 <p><!-- CL 483235 -->
422 TODO: <a href="https://go.dev/cl/483235">https://go.dev/cl/483235</a>: embed: implement openFile.ReadAt
427 <dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
429 <p><!-- https://go.dev/issue/41198, CL 473935 -->
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.
441 <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
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)
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
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
457 <dl id="fs"><dt><a href="/pkg/fs/">fs</a></dt>
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
465 <dl id="go/ast"><dt><a href="/pkg/go/ast/">go/ast</a></dt>
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.
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
482 <dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
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
488 </dl><!-- go/build -->
490 <dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
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
496 </dl><!-- go/build/constraint -->
498 <dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
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>.
506 </dl><!-- go/token -->
508 <dl id="hash/maphash"><dt><a href="/pkg/hash/maphash/">hash/maphash</a></dt>
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
514 <p><!-- CL 468795 -->
515 TODO: <a href="https://go.dev/cl/468795">https://go.dev/cl/468795</a>: hash/maphash: add purego implementation
518 </dl><!-- hash/maphash -->
520 <dl id="io/fs"><dt><a href="/pkg/io/fs/">io/fs</a></dt>
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
528 <dl id="log/slog"><dt><a href="/pkg/log/slog/">log/slog</a></dt>
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
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
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
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
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
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)
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
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
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
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
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
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
578 </dl><!-- log/slog -->
580 <dl id="math"><dt><a href="/pkg/math/">math</a></dt>
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
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
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
596 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
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.
605 </dl><!-- math/big -->
607 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
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
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
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>
634 In a future Go release we may enable Multipath TCP by default on
635 systems that support it.
640 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
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.
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
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>
658 </dl><!-- net/http -->
660 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
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.
668 <p><!-- CL 480135 -->
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.
675 <p><!-- CL 477215 -->
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.
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.
689 <!-- CL 459455 reverted -->
691 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
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.
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>.
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>.
719 </dl><!-- reflect -->
721 <dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
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>
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>.
737 <dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
739 <p><!-- https://go.dev/issue/38651 -->
740 TODO: <a href="https://go.dev/issue/38651">https://go.dev/issue/38651</a>: add 'created by goroutine number' to stack traces
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
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
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
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
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
766 <a href="https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers">cgo pointer passing rules.</a>
768 See <a href="/pkg/runtime#Pinner">the docs</a> for more details.
771 </dl><!-- runtime -->
773 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
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.
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.
785 </dl><!-- runtime/trace -->
787 <dl id="runtime/metrics"><dt><a href="/pkg/runtime/metrics/">runtime/metrics</a></dt>
789 <p><!-- https://go.dev/issue/56857 -->
790 A few previously-internal GC metrics, such as live heap size, are
793 <code>GOGC</code> and <code>GOMEMLIMIT</code> are also now
794 available as metrics.
797 </dl><!-- runtime/metrics -->
799 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
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.
811 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
813 <p><!-- CL 480135 -->
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.
820 <p><!-- https://go.dev/issue/46259, CL 458335 -->
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.
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.
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>
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>
854 </dl><!-- syscall -->
856 <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
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.
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>.
867 </dl><!-- testing -->
869 <dl id="testing/slogtest"><dt><a href="/pkg/testing/slogtest/">testing/slogtest</a></dt>
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
875 </dl><!-- testing/slogtest -->
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 -->