mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
1f4d14e493
commit
12c8d14d94
1 changed files with 1 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ func Unwrap(err error) error {
|
|||
}
|
||||
|
||||
// Is reports whether any error in err's tree matches target.
|
||||
// The target must be comparable.
|
||||
//
|
||||
// The tree consists of err itself, followed by the errors obtained by repeatedly
|
||||
// calling its Unwrap() error or Unwrap() []error method. When err wraps multiple
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue