From ff8bf161714b68035835bb4e611b72f9603f4c07 Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 12 Feb 2023 21:10:34 +0800 Subject: [PATCH] fix gosec G307 --- model/notification.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/notification.go b/model/notification.go index 11ddac4..1daec30 100644 --- a/model/notification.go +++ b/model/notification.go @@ -149,7 +149,9 @@ func (ns *NotificationServerBundle) Send(message string) error { } if resp.StatusCode < 200 || resp.StatusCode > 299 { - defer resp.Body.Close() + defer func() { + _ = resp.Body.Close() + }() body, _ := io.ReadAll(resp.Body) return fmt.Errorf("%d@%s %s", resp.StatusCode, resp.Status, string(body)) }