aboutsummaryrefslogtreecommitdiff
path: root/src/errors/errors_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors/errors_test.go')
-rw-r--r--src/errors/errors_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/errors/errors_test.go b/src/errors/errors_test.go
index cf4df90b69..8b93f530d5 100644
--- a/src/errors/errors_test.go
+++ b/src/errors/errors_test.go
@@ -51,3 +51,21 @@ func ExampleNew_errorf() {
}
// Output: user "bimmler" (id 17) not found
}
+
+func ExampleJoin() {
+ err1 := errors.New("err1")
+ err2 := errors.New("err2")
+ err := errors.Join(err1, err2)
+ fmt.Println(err)
+ if errors.Is(err, err1) {
+ fmt.Println("err is err1")
+ }
+ if errors.Is(err, err2) {
+ fmt.Println("err is err2")
+ }
+ // Output:
+ // err1
+ // err2
+ // err is err1
+ // err is err2
+}