From f3031b879bf9465be9020fdcb661cc88be11e7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edmond=20Dant=C3=A8s?= <18221510672@139.com> Date: Fri, 6 Sep 2024 14:19:17 +0800 Subject: [PATCH] fix golangci-lint issue --- request.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/request.go b/request.go index 0ff6d9e..7635c51 100644 --- a/request.go +++ b/request.go @@ -217,7 +217,9 @@ func (r *Requester) Do(req *http.Request, v interface{}) (*http.Response, error) *w = strings.Trim(string(body), "\"\n") } else { - io.CopyN(io.Discard, resp.Body, 5) + if _, err := io.CopyN(io.Discard, resp.Body, 5); err != nil { + return resp, err + } if err := json.NewDecoder(resp.Body).Decode(&v); err != nil { return resp, err }