]> Cypherpunks repositories - gostls13.git/commit
errors: return early for Is(nil, ...)
authorTobias Klauser <tklauser@distanz.ch>
Wed, 3 Apr 2024 09:50:36 +0000 (11:50 +0200)
committerGopher Robot <gobot@golang.org>
Wed, 3 Apr 2024 22:49:49 +0000 (22:49 +0000)
commitaf43932c20d5b59cdffca45406754dbccbb46dfa
tree968e7d230be3a65bb690d1252d4e0459ed4d24db
parenta4440e3d236dc2ca65851c39a51958cc1b3c03fb
errors: return early for Is(nil, ...)

If err is nil it wouldn't match any given target error except for nil,
so we can return early to speed up cases where Is is used without a
preceding err != nil check.

Change-Id: Ib33cff50453fe070f06871ce8074694c81ab787b
Reviewed-on: https://go-review.googlesource.com/c/go/+/576015
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/errors/wrap.go
src/errors/wrap_test.go