From: Damien Neil Date: Mon, 14 Nov 2022 20:20:17 +0000 (-0800) Subject: doc/go1.20: add a release note for multiple error wrapping X-Git-Tag: go1.20rc1~269 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=787f8167e433e156ead1b06a2f965f415b3635ec;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- 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.

Wrapping multiple errors

- TODO: https://go.dev/cl/432898: 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. +

+

+ An error e can wrap more than one error by providing + an Unwrap method that returns a []error. +

+

+ The errors.Is and + errors.As functions + have been updated to inspect multiply wrapped errors. +

+

+ The fmt.Errorf function + now supports multiple occurrances of the %w format verb, + which will cause it to return an error that wraps all of those error operands. +

+

+ The new function errors.Join + returns an error wrapping a list of errors.

Minor changes to the library

@@ -312,8 +331,20 @@ Do not send CLs removing the interior tags from such phrases. +
errors
+
+

+ The new Join function returns an error wrapping a list of errors. +

+
+
+
fmt
+

+ The Errorf function supports multiple occurrances of + the %w format verb. +

TODO: https://go.dev/issue/51668: add FormatString(State) string