From 0c5072ae97453446517ff1b83f7f1d247efbf362 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Sat, 30 Dec 2023 20:43:03 +0300 Subject: [PATCH 1/2] bodyclose enabled --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 1c564ed04..846ace412 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -207,7 +207,6 @@ linters-settings: linters: enable-all: true disable: - - bodyclose - containedctx - contextcheck - cyclop From 87b5fb76c369c91aaa418373e5a67d323ad329c7 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Sat, 30 Dec 2023 20:46:30 +0300 Subject: [PATCH 2/2] fix bodyclose --- examples/serverless/healthcheck/service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/serverless/healthcheck/service.go b/examples/serverless/healthcheck/service.go index 60df561f5..2bcbed010 100644 --- a/examples/serverless/healthcheck/service.go +++ b/examples/serverless/healthcheck/service.go @@ -106,6 +106,9 @@ func (s *service) ping(path string) (code int32, err error) { if err != nil { return -1, err } + defer func() { + _ = response.Body.Close() + }() return int32(response.StatusCode), nil }