Skip to content

Commit 8e436f6

Browse files
committed
fix(provider-tck): check the control response body's Close
`defer resp.Body.Close()` discards an error errcheck requires to be handled, so `make lint` failed on the suite module and, by inheritance, on all three stacked branches. The shape was invisible until this client moved onto the base branch: at its previous home in providers/flagd/e2e it sat behind `//go:build e2e`, and golangci-lint does not analyse files excluded by a build tag. Nothing about the code changed -- only whether anything looked at it. Discarded explicitly rather than logged: the request has already returned its status, the body is drained immediately above, and a failure to close a body the caller is finished with tells an adopter nothing it can act on. `_ =` matches the `_, _ = io.Copy` on the following line. Signed-off-by: Simon Schrottner <simon.schrottner@flagsmith.com>
1 parent 84fd316 commit 8e436f6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/provider-tck/pkg/tck/httpcontrol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (c *HTTPControl) call(ctx context.Context, path string, query url.Values) (
235235
"reachable even while the backend is deliberately down, otherwise an outage cannot be ended",
236236
target, err)
237237
}
238-
defer resp.Body.Close()
238+
defer func() { _ = resp.Body.Close() }()
239239

240240
_, _ = io.Copy(io.Discard, resp.Body)
241241

0 commit comments

Comments
 (0)