From 87754111ce03f7313dc09647cd692174de4e119e Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Thu, 23 Sep 2021 21:11:20 +0800 Subject: [PATCH] fix: make golangci-lint happy --- server/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/http.go b/server/http.go index c9f141f..8caf1e9 100644 --- a/server/http.go +++ b/server/http.go @@ -239,6 +239,8 @@ func (c *HTTPClient) onBotPushEvent(e *coolq.Event) { for i := 0; i <= maxAttemptTimes; i++ { res, err = client.Do(req) if err == nil { + //goland:noinspection GoDeferInLoop + defer res.Body.Close() break } if i != maxAttemptTimes { @@ -256,7 +258,6 @@ func (c *HTTPClient) onBotPushEvent(e *coolq.Event) { } log.Debugf("上报Event数据 %s 到 %v", e.JSONBytes(), c.addr) - defer res.Body.Close() r, err := io.ReadAll(res.Body) if err != nil { return