errors: add joinError Unwrap example

Change-Id: Id7489247e9bdd413f82fdf5a70197856c47abfb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/674336
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
This commit is contained in:
jiahua wang 2025-05-20 13:40:18 +08:00 committed by Gopher Robot
parent 787362327f
commit ed70477909

View file

@ -66,11 +66,13 @@ func ExampleJoin() {
if errors.Is(err, err2) {
fmt.Println("err is err2")
}
fmt.Println(err.(interface{ Unwrap() []error }).Unwrap())
// Output:
// err1
// err2
// err is err1
// err is err2
// [err1 err2]
}
func ExampleIs() {