From c583104ee6331a6d006b493e85e0881d35164c93 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Fri, 10 May 2019 15:32:24 +0700 Subject: [PATCH] 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 Reviewed-by: Brad Fitzpatrick --- src/errors/wrap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/errors/wrap.go b/src/errors/wrap.go index 69dd9464ec..b53caa6fc9 100644 --- a/src/errors/wrap.go +++ b/src/errors/wrap.go @@ -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