Skip to content

Commit 787f816

Browse files
committed
doc/go1.20: add a release note for multiple error wrapping
For #53435. Change-Id: I894bd645b0b61d7dd5f3aae7d1ea7b8a12f31dd8 Reviewed-on: https://go-review.googlesource.com/c/go/+/450376 Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent b4ff479 commit 787f816

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

doc/go1.20.html

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,26 @@ <h3 id="crypto/ecdh">New <code>crypto/ecdh</code> package</h3>
165165
<h3 id="errors">Wrapping multiple errors</h3>
166166

167167
<p><!-- CL 432898 -->
168-
TODO: <a href="https://go.dev/cl/432898">https://go.dev/cl/432898</a>: errors, fmt: add support for wrapping multiple errors
168+
Go 1.20 expands support for error wrapping to permit an error to
169+
wrap multiple other errors.
170+
</p>
171+
<p>
172+
An error <code>e</code</e> can wrap more than one error by providing
173+
an <code>Unwrap</code> method that returns a <code>[]error</code>.
174+
</p>
175+
<p>
176+
The <a href="/pkg/errors/#Is"><code>errors.Is</code></a> and
177+
<a href="/pkg/errors/#As"><code>errors.As</code></a> functions
178+
have been updated to inspect multiply wrapped errors.
179+
</p>
180+
<p>
181+
The <a href="/pkg/fmt/#Errorf"><code>fmt.Errorf</code></a> function
182+
now supports multiple occurrances of the <code>%w</code> format verb,
183+
which will cause it to return an error that wraps all of those error operands.
184+
</p>
185+
<p>
186+
The new function <a href="/pkg/errors/#Join"><code>errors.Join</code></a>
187+
returns an error wrapping a list of errors.
169188
</p>
170189

171190
<h3 id="minor_library_changes">Minor changes to the library</h3>
@@ -312,8 +331,20 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
312331
</dd>
313332
</dl><!-- encoding/xml -->
314333

334+
<dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
335+
<dd>
336+
<p><!-- https://go.dev/issue/53435 -->
337+
The new <code>Join</code> function returns an error wrapping a list of errors.
338+
</p>
339+
</dd>
340+
</dl><!-- errors -->
341+
315342
<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
316343
<dd>
344+
<p><!-- https://go.dev/issue/53435 -->
345+
The <code>Errorf</code> function supports multiple occurrances of
346+
the <code>%w</code> format verb.
347+
</p>
317348
<p><!-- https://go.dev/issue/51668 -->
318349
TODO: <a href="https://go.dev/issue/51668">https://go.dev/issue/51668</a>: add FormatString(State) string
319350
</p>

0 commit comments

Comments
 (0)