From 60b6d68339e923df557a8f73ea3c576c6bb86751 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sat, 19 Nov 2022 23:03:14 +0800 Subject: [PATCH] fix: better error check --- dns/doh.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dns/doh.go b/dns/doh.go index 6e3e8d88..4d928bdc 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -12,7 +12,6 @@ import ( "net/url" "runtime" "strconv" - "strings" "sync" "time" @@ -141,7 +140,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D. msg, err = doh.exchangeHTTPS(ctx, client, m) } - if err != nil && !strings.Contains(err.Error(), "context canceled") { + if err != nil && !errors.Is(err, context.Canceled) { // If the request failed anyway, make sure we don't use this client. _, resErr := doh.resetClient(ctx, err)