aboutsummaryrefslogtreecommitdiff
path: root/src/errors/wrap.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-10-27 12:27:12 -0700
committerGopher Robot <gobot@golang.org>2025-10-28 08:30:47 -0700
commit12c8d14d947ba922e19e3360ce5decd2bb848257 (patch)
tree035b327274fdb78c3f2a1bfb413a256d67acbe33 /src/errors/wrap.go
parent1f4d14e493516af6017ed9b467e7daf772752f98 (diff)
downloadgo-12c8d14d947ba922e19e3360ce5decd2bb848257.tar.xz
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>
Diffstat (limited to 'src/errors/wrap.go')
-rw-r--r--src/errors/wrap.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/errors/wrap.go b/src/errors/wrap.go
index 2ebb951f1d..e4a5ca33d5 100644
--- a/src/errors/wrap.go
+++ b/src/errors/wrap.go
@@ -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