]> Cypherpunks repositories - gostls13.git/commitdiff
errors: remove useless condition checking in Is
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Fri, 10 May 2019 08:32:24 +0000 (15:32 +0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 13 May 2019 13:54:54 +0000 (13:54 +0000)
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>
src/errors/wrap.go

index 69dd9464ec8e037891d2ec5079f06056da983fbd..b53caa6fc9a137ef75c26c7fb58a419d8ab9f57c 100644 (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