From 334e3179d4846d722386c4f03894839ba032a683 Mon Sep 17 00:00:00 2001 From: Alex Godoroja Date: Tue, 23 Jun 2026 13:05:25 -0700 Subject: [PATCH] fix(gosec): handle resp.Body.Close on the catalogue fetch error path (G104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit httpGet ignored the Close() error in the non-200 branch. Discard it explicitly — the status error returned below is the actionable one. --- internal/catalogue/catalogue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/catalogue/catalogue.go b/internal/catalogue/catalogue.go index 61858b09..dfddd7bb 100644 --- a/internal/catalogue/catalogue.go +++ b/internal/catalogue/catalogue.go @@ -128,7 +128,7 @@ func httpGet(raw string) (io.ReadCloser, error) { return nil, err } if resp.StatusCode != http.StatusOK { - resp.Body.Close() + _ = resp.Body.Close() // discarding on the error path; the status error below is what matters return nil, fmt.Errorf("GET %s: status %d", raw, resp.StatusCode) } return resp.Body, nil