Go 1.21 is not yet released. These are work-in-progress release notes. Go 1.21 is expected to be released in August 2023.
TODO: complete this section
TODO: complete this section, or delete if not needed
TODO: complete this section, or delete if not needed
TODO: complete this section, or delete if not needed
When printing very deep stacks, the runtime now prints the first 50 (innermost) frames followed by the bottom 50 (outermost) frames, rather than just printing the first 100 frames. This makes it easier to see how deeply recursive stacks started, and is especially valuable for debugging stack overflows.
TODO: complete this section, or delete if not needed
TODO: complete this section, or delete if not needed
As always, there are various minor changes and updates to the library, made with the Go 1 promise of compatibility in mind. There are also various performance improvements, not enumerated here.
TODO: complete this section
The new WithoutCancel
function returns a copy of a context that is not canceled when the original
context is canceled.
The new WithDeadlineCause
and WithTimeoutCause
functions provide a way to set a context cancellation cause when a deadline or
timer expires. The cause may be retrieved with the
Cause
function.
The new AfterFunc
function registers a function to run after a context has been cancelled.
In Go 1.21, ValueOf
no longer forces its argument to be allocated on the heap, allowing
a Value
's content to be allocated on the stack. Most
operations on a Value
also allow the underlying value
to be stack allocated.
The new OnceFunc
,
OnceValue
, and
OnceValues
functions capture a common use of Once to
lazily initialize a value on first use.