Skip to content

Commit 12c8d14

Browse files
neildgopherbot
authored andcommitted
errors: document that the target of Is must be comparable
If target is not comparable, then errors.Is(err, target) can panic. (Put another way, if target == target panics, then Is can panic.) Document that the target must be comparable. For #74488 Change-Id: I694dc4c91a608b80f044f06dd1c6ac32b8e77c9c Reviewed-on: https://go-review.googlesource.com/c/go/+/715440 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Damien Neil <dneil@google.com> TryBot-Bypass: Damien Neil <dneil@google.com>
1 parent 1f4d14e commit 12c8d14

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/errors/wrap.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func Unwrap(err error) error {
2525
}
2626

2727
// Is reports whether any error in err's tree matches target.
28+
// The target must be comparable.
2829
//
2930
// The tree consists of err itself, followed by the errors obtained by repeatedly
3031
// calling its Unwrap() error or Unwrap() []error method. When err wraps multiple

0 commit comments

Comments
 (0)