1
0
mirror of https://github.com/golang/go synced 2024-09-29 18:34:33 -06: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:
LE Manh Cuong 2019-05-10 15:32:24 +07:00 committed by Brad Fitzpatrick
parent afd79150d9
commit c583104ee6

View File

@ -52,7 +52,7 @@ func Is(err, target error) bool {
return err == target
}
isComparable := target == nil || reflectlite.TypeOf(target).Comparable()
isComparable := reflectlite.TypeOf(target).Comparable()
for {
if isComparable && err == target {
return true