From eb848a66c22afb215e57fbb8a1a1d18ad4ea78d6 Mon Sep 17 00:00:00 2001 From: Cenk Alti Date: Fri, 5 Jun 2020 17:11:59 +0300 Subject: [PATCH] use errors.Is to compare errors --- internal/announcer/announce.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/announcer/announce.go b/internal/announcer/announce.go index c5c8ed39..67131c95 100644 --- a/internal/announcer/announce.go +++ b/internal/announcer/announce.go @@ -2,6 +2,7 @@ package announcer import ( "context" + "errors" "github.com/cenkalti/rain/internal/tracker" ) @@ -21,7 +22,7 @@ func announce( NumWant: numWant, } annResp, err := trk.Announce(ctx, annReq) - if err == context.Canceled { + if errors.Is(err, context.Canceled) { return } if err != nil {