From 7c404d8b5e76b0d1816fabcc917c5a458708323f Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Thu, 18 Aug 2022 17:55:56 -0400 Subject: [PATCH] fix error type comparison --- lib/retry/retry.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/retry/retry.go b/lib/retry/retry.go index 0f53fe91e..ef54e10b2 100644 --- a/lib/retry/retry.go +++ b/lib/retry/retry.go @@ -2,6 +2,7 @@ package retry import ( "errors" + "reflect" "time" logging "github.com/ipfs/go-log/v2" @@ -11,8 +12,8 @@ var log = logging.Logger("retry") func errorIsIn(err error, errorTypes []error) bool { for _, etype := range errorTypes { - tmp := etype - if errors.As(err, &tmp) { + tmp := reflect.New(reflect.PointerTo(reflect.ValueOf(etype).Elem().Type())).Interface() + if errors.As(err, tmp) { return true } }