summaryrefslogtreecommitdiff
path: root/doc/go1.21.html
blob: 66bf5470baf729a4de6052bb552424635a19226d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!--{
	"Title": "Go 1.21 Release Notes",
	"Path":  "/doc/go1.21"
}-->

<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->

<style>
  main ul li { margin: 0.5em 0; }
</style>

<h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.21</h2>

<p>
  <strong>
    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.
  </strong>
</p>

<h2 id="language">Changes to the language</h2>

<p>
  TODO: complete this section
</p>

<h2 id="ports">Ports</h2>

<h3 id="wasip1">WebAssembly System Interface</h3>

<p><!-- https://go.dev/issue/58141 -->
  Go 1.21 adds an experimental port to the <a href="https://wasi.dev/">
  WebAssembly System Interface (WASI)</a>, Preview 1
  (<code>GOOS=wasip1</code>, <code>GOARCH=wasm</code>).
</p>

<p>
  As a result of the addition of the new <code>GOOS</code> value
  "<code>wasip1</code>", Go files named <code>*_wasip1.go</code>
  will now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored
  by Go tools</a> except when that GOOS value is being used. If you
  have existing filenames matching that pattern, you will need to
  rename them.
</p>

<h2 id="tools">Tools</h2>

<h3 id="go-command">Go command</h3>

<p><-- https://go.dev/issue/58099, CL 474236 -->
  The <code>-pgo</code> build flag now defaults to <code>-pgo=auto</code>,
  and the restriction of specifying a single main package on the command
  line is now removed. If a file named <code>default.pgo</code> is present
  in the main package's directory, the <code>go</code> command will use
  it to enable profile-guided optimization for building the corresponding
  program.
</p>

<h2 id="runtime">Runtime</h2>

<p>
  TODO: complete this section, or delete if not needed
</p>

<p><!-- https://go.dev/issue/7181 -->
  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.
</p>

<h2 id="compiler">Compiler</h2>

<p>
  TODO: complete this section, or delete if not needed
</p>

<h2 id="linker">Linker</h2>

<p>
  TODO: complete this section, or delete if not needed
</p>

<h2 id="library">Core library</h2>

<h3 id="minor_library_changes">Minor changes to the library</h3>

<p>
  As always, there are various minor changes and updates to the library,
  made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
  in mind.
  There are also various performance improvements, not enumerated here.
</p>

<p>
  TODO: complete this section
</p>

<dl id="context"><dt><a href="/pkg/context/">context</a></dt>
  <dd>
    <p><!-- https://go.dev/issue/40221, CL 479918 -->
      The new <a href="/pkg/context/#WithoutCancel"><code>WithoutCancel</code></a>
      function returns a copy of a context that is not canceled when the original
      context is canceled.
    </p>
    <p><!-- https://go.dev/issue/56661, CL 449318 -->
      The new <a href="/pkg/context/#WithDeadlineCause"><code>WithDeadlineCause</code></a>
      and <a href="/pkg/context/#WithTimeoutCause"><code>WithTimeoutCause</code></a>
      functions provide a way to set a context cancellation cause when a deadline or
      timer expires. The cause may be retrieved with the
      <a href="/pkg/context/#Cause"><code>Cause</code></a> function.
    </p>
    <p><!-- https://go.dev/issue/57928, CL 482695 -->
      The new <a href="/pkg/context/#AfterFunc"><code>AfterFunc</code></a>
      function registers a function to run after a context has been cancelled.
    </p>
  </dd>
</dl>

<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
  <dd>
    <p><!-- CL 408826, CL 413474 -->
      In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
      no longer forces its argument to be allocated on the heap, allowing
      a <code>Value</code>'s content to be allocated on the stack. Most
      operations on a <code>Value</code> also allow the underlying value
      to be stack allocated.
    </p>
  </dd>
</dl>

<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
  <dd>
    <p><!-- https://go.dev/issue/56102, CL 451356 -->
      The new <a href="/pkg/sync/#OnceFunc"><code>OnceFunc</code></a>,
      <a href="/pkg/sync/#OnceValue"><code>OnceValue</code></a>, and
      <a href="/pkg/sync/#OnceValues"><code>OnceValues</code></a>
      functions capture a common use of <a href="/pkg/sync/#Once">Once</a> to
      lazily initialize a value on first use.
    </p>
  </dd>
</dl>