Skip to content

Commit 6063efb

Browse files
matttproudneild
authored andcommitted
blog: clarify what is meant by equality in article
The blog article https://go.dev/blog/go1.13-errors explains when package errors use a user-authored Is method on an error. It does this in the context of error value equality. Because errors are often implemented as pointer values (and receivers), which may have non-obvious semantics to newcomers, this presents a good opportunity to remind the reader what equality means in such cases. This commit is largely cosmetic and provides a link back to the relevant part of the language specification. Change-Id: I0e312fa1385e7caa9944eaff4ac788c91c3294dd Reviewed-on: https://go-review.googlesource.com/c/website/+/358354 Reviewed-by: Jean de Klerk <[email protected]> Reviewed-by: Damien Neil <[email protected]> Trust: Jean de Klerk <[email protected]> Run-TryBot: Jean de Klerk <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 281050f commit 6063efb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

go.dev/_content/blog/go1.13-errors.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,10 @@ information to preserve an abstraction layer.
237237
## Customizing error tests with Is and As methods
238238

239239
The `errors.Is` function examines each error in a chain for a match with a
240-
target value. By default, an error matches the target if the two are equal. In
241-
addition, an error in the chain may declare that it matches a target by
242-
implementing an `Is` _method_.
240+
target value. By default, an error matches the target if the two are
241+
[equal](https://golang.org/ref/spec#Comparison_operators). In addition, an
242+
error in the chain may declare that it matches a target by implementing an `Is`
243+
_method_.
243244

244245
As an example, consider this error inspired by the
245246
[Upspin error package](https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html)

0 commit comments

Comments
 (0)