From 343bb382d2192b88d84af49971bb5cb99bee268c Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 28 Oct 2026 16:11:32 +0100 Subject: [PATCH] build(lint): bump golangci-lint to v2.15.0 and fix what it now reports The release updates errcheck (1.20 to 1.30) and gocognit (1.2.1 to 1.3.0). errcheck now reports the receives from an error channel whose value is dropped on purpose, in three places: waiting for the attach copy to end after the context is done, draining the container wait channel of a failed hook, and waiting for Up to return in a test. Say why on each, rather than handling an error nobody can act on. gocognit's new count is handled by the previous commit. Signed-off-by: Nicolas De Loof --- Dockerfile | 2 +- pkg/compose/hook.go | 2 +- pkg/compose/pre_start.go | 2 +- pkg/compose/up_phases_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7e3c0b39..b39618746 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ARG GO_VERSION=1.26.10 ARG XX_VERSION=1.9.0 -ARG GOLANGCI_LINT_VERSION=v2.13.2 +ARG GOLANGCI_LINT_VERSION=v2.15.0 ARG ADDLICENSE_VERSION=v1.0.0 # Keep in sync with GOTESTSUM_VERSION in the Makefile ARG GOTESTSUM_VERSION=v1.13.0 diff --git a/pkg/compose/hook.go b/pkg/compose/hook.go index 2e27da9ef..cb2655298 100644 --- a/pkg/compose/hook.go +++ b/pkg/compose/hook.go @@ -122,7 +122,7 @@ func (s *composeService) runHook(ctx context.Context, ctr container.Summary, ser // Close the connection to unblock the blocked Read in the copy goroutine, // then wait for it to exit before returning so there is no goroutine leak. attach.Close() - <-copyDone + <-copyDone //nolint:errcheck // the copy error is irrelevant: the context error is returned return ctx.Err() } diff --git a/pkg/compose/pre_start.go b/pkg/compose/pre_start.go index b3aba4069..9b0cda031 100644 --- a/pkg/compose/pre_start.go +++ b/pkg/compose/pre_start.go @@ -208,7 +208,7 @@ func (s *composeService) execPreStartHook( // Drain waitRes so the client's wait goroutine exits without having to // wait for the parent context to be canceled. select { - case <-waitRes.Error: + case <-waitRes.Error: //nolint:errcheck // only draining: the error that matters is the one being returned case <-waitRes.Result: case <-ctx.Done(): } diff --git a/pkg/compose/up_phases_test.go b/pkg/compose/up_phases_test.go index 664357360..9f6f14fd7 100644 --- a/pkg/compose/up_phases_test.go +++ b/pkg/compose/up_phases_test.go @@ -289,7 +289,7 @@ func (h *interactiveUpHarness) upWith(t *testing.T, ctx context.Context, cancel case <-time.After(10 * time.Second): cancel() select { - case <-done: + case <-done: //nolint:errcheck // only waiting for up to return, the test fails right below case <-time.After(5 * time.Second): } t.Fatalf("up did not return; calls so far: %v", h.daemon.recorded())