mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
errors: remove useless condition checking in Is
golang.org/cl/175260 fixed Is panics if target is uncomparable. It did add an useless condition checking whether target is comparable. Just remove that condition. Change-Id: I0a317056479638d209b0a0cbc7010c153558c087 Reviewed-on: https://go-review.googlesource.com/c/go/+/176497 Reviewed-by: Joan Lopez de la Franca Beltran <joanjan14@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
afd79150d9
commit
c583104ee6
@ -52,7 +52,7 @@ func Is(err, target error) bool {
|
|||||||
return err == target
|
return err == target
|
||||||
}
|
}
|
||||||
|
|
||||||
isComparable := target == nil || reflectlite.TypeOf(target).Comparable()
|
isComparable := reflectlite.TypeOf(target).Comparable()
|
||||||
for {
|
for {
|
||||||
if isComparable && err == target {
|
if isComparable && err == target {
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user