mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
787362327f
commit
ed70477909
1 changed files with 2 additions and 0 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue