From: Olivier Mengué Date: Thu, 26 Oct 2023 20:18:33 +0000 (+0200) Subject: errors: clarify references to Unwrap in doc X-Git-Tag: go1.22rc1~182 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ef7b713fefdcfef83101eda880015dded5fadb98;p=gostls13.git errors: clarify references to Unwrap in doc 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 Run-TryBot: qiulaidongfeng <2645477756@qq.com> TryBot-Result: Gopher Robot Reviewed-by: David Chase --- diff --git a/src/errors/wrap.go b/src/errors/wrap.go index e1cc466eea..88ee0a9281 100644 --- a/src/errors/wrap.go +++ b/src/errors/wrap.go @@ -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