]> Cypherpunks repositories - gostls13.git/commitdiff
errors: clarify references to Unwrap in doc
authorOlivier Mengué <olivier.mengue@gmail.com>
Thu, 26 Oct 2023 20:18:33 +0000 (22:18 +0200)
committerCherry Mui <cherryyz@google.com>
Tue, 21 Nov 2023 22:04:29 +0000 (22:04 +0000)
CL 535080 incorrectly links the unclear mention of Unwrap to the func
Unwrap in doc for errors.Is and errors.As

Instead we clarify that "Unwrap" is a reference
to the "Unwrap() error" or "Unwrap() []error" methods, not to the
"Unwrap(error) error" function which is also available in the package.

Change-Id: I8314993932e1e7a2dc77400f74d81f3a8aa891de
Reviewed-on: https://go-review.googlesource.com/c/go/+/538155
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/errors/wrap.go

index e1cc466eeaa67ad659268fb9a4ff35bcb3843a14..88ee0a9281f2f13b6e2bcaeb77163a4760497725 100644 (file)
@@ -27,8 +27,8 @@ func Unwrap(err error) error {
 // Is reports whether any error in err's tree matches target.
 //
 // The tree consists of err itself, followed by the errors obtained by repeatedly
-// calling [Unwrap]. When err wraps multiple errors, Is examines err followed by a
-// depth-first traversal of its children.
+// calling its Unwrap() error or Unwrap() []error method. When err wraps multiple
+// errors, Is examines err followed by a depth-first traversal of its children.
 //
 // An error is considered to match a target if it is equal to that target or if
 // it implements a method Is(error) bool such that Is(target) returns true.
@@ -81,8 +81,8 @@ func is(err, target error, targetComparable bool) bool {
 // target to that error value and returns true. Otherwise, it returns false.
 //
 // The tree consists of err itself, followed by the errors obtained by repeatedly
-// calling [Unwrap]. When err wraps multiple errors, As examines err followed by a
-// depth-first traversal of its children.
+// calling its Unwrap() error or Unwrap() []error method. When err wraps multiple
+// errors, As examines err followed by a depth-first traversal of its children.
 //
 // An error matches target if the error's concrete value is assignable to the value
 // pointed to by target, or if the error has a method As(interface{}) bool such that