summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2022-11-14 12:20:17 -0800
committerDamien Neil <dneil@google.com>2022-11-15 16:24:18 +0000
commit787f8167e433e156ead1b06a2f965f415b3635ec (patch)
tree9eac30b9b9a7f723a26114f882ab2fa07f8ababd /doc
parentb4ff4792989853b82150c1dc136ba024f6a09d0a (diff)
downloadgo-git-787f8167e433e156ead1b06a2f965f415b3635ec.tar.gz
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 <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/go1.20.html33
1 files changed, 32 insertions, 1 deletions
diff --git a/doc/go1.20.html b/doc/go1.20.html
index 767b6b646f..a64a8d8f3e 100644
--- a/doc/go1.20.html
+++ b/doc/go1.20.html
@@ -165,7 +165,26 @@ Do not send CLs removing the interior tags from such phrases.
<h3 id="errors">Wrapping multiple errors</h3>
<p><!-- CL 432898 -->
- TODO: <a href="https://go.dev/cl/432898">https://go.dev/cl/432898</a>: errors, fmt: add support for wrapping multiple errors
+ Go 1.20 expands support for error wrapping to permit an error to
+ wrap multiple other errors.
+</p>
+<p>
+ An error <code>e</code</e> can wrap more than one error by providing
+ an <code>Unwrap</code> method that returns a <code>[]error</code>.
+</p>
+<p>
+ The <a href="/pkg/errors/#Is"><code>errors.Is</code></a> and
+ <a href="/pkg/errors/#As"><code>errors.As</code></a> functions
+ have been updated to inspect multiply wrapped errors.
+</p>
+<p>
+ The <a href="/pkg/fmt/#Errorf"><code>fmt.Errorf</code></a> function
+ now supports multiple occurrances of the <code>%w</code> format verb,
+ which will cause it to return an error that wraps all of those error operands.
+</p>
+<p>
+ The new function <a href="/pkg/errors/#Join"><code>errors.Join</code></a>
+ returns an error wrapping a list of errors.
</p>
<h3 id="minor_library_changes">Minor changes to the library</h3>
@@ -312,8 +331,20 @@ Do not send CLs removing the interior tags from such phrases.
</dd>
</dl><!-- encoding/xml -->
+<dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
+ <dd>
+ <p><!-- https://go.dev/issue/53435 -->
+ The new <code>Join</code> function returns an error wrapping a list of errors.
+ </p>
+ </dd>
+</dl><!-- errors -->
+
<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
<dd>
+ <p><!-- https://go.dev/issue/53435 -->
+ The <code>Errorf</code> function supports multiple occurrances of
+ the <code>%w</code> format verb.
+ </p>
<p><!-- https://go.dev/issue/51668 -->
TODO: <a href="https://go.dev/issue/51668">https://go.dev/issue/51668</a>: add FormatString(State) string
</p>