From 3e06aff566e7deb08bdbd941bfc93dc74e4256b0 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 27 Oct 2026 12:57:26 -0700 Subject: [PATCH] ci: bump golangci-lint to v2.15 Fix new errcheck warnings about unchecked errors received from channels: libcontainer/configs/config.go:632:3: Error return value is not checked (errcheck) libcontainer/logs/logs_linux_test.go:62:7: Error return value is not checked (errcheck) notify_socket_test.go:73:7: Error return value is not checked (errcheck) In the hook timeout case, the error from Wait is expected after Kill, so add a nolint annotation (using "_ =" upsets staticcheck's S1005). Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 2 +- libcontainer/configs/config.go | 2 +- libcontainer/logs/logs_linux_test.go | 5 ++++- notify_socket_test.go | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 909ddceac..2a067bee7 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -54,7 +54,7 @@ jobs: sudo apt -qy install libseccomp-dev - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: - version: v2.13 + version: v2.15 skip-cache: true # Extra linters, only checking new code from a pull request to main. - name: lint-extra diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index 5306bfc20..3c167e995 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -629,7 +629,7 @@ func (c *Command) Run(s *specs.State) error { return err case <-timerCh: _ = cmd.Process.Kill() - <-errC + <-errC //nolint:errcheck // Wait error is expected after Kill. return fmt.Errorf("hook ran past specified timeout of %.1fs", c.Timeout.Seconds()) } } diff --git a/libcontainer/logs/logs_linux_test.go b/libcontainer/logs/logs_linux_test.go index b80d28dbd..c5abcd8aa 100644 --- a/libcontainer/logs/logs_linux_test.go +++ b/libcontainer/logs/logs_linux_test.go @@ -59,7 +59,10 @@ func TestLogForwardingStopsAfterClosingTheWriter(t *testing.T) { // Do not use finish() here as we check done pipe ourselves. l.w.Close() select { - case <-l.done: + case err := <-l.done: + if err != nil { + t.Fatal(err) + } case <-time.After(10 * time.Second): t.Fatal("log forwarding did not stop after closing the pipe") } diff --git a/notify_socket_test.go b/notify_socket_test.go index 81210851d..86a59928e 100644 --- a/notify_socket_test.go +++ b/notify_socket_test.go @@ -70,8 +70,8 @@ func expectBarrier(t *testing.T, conn *net.UnixConn, notifyHostChan <-chan error case <-timer.C: // this is the expected case break - case <-notifyHostChan: - t.Fatal("runc has terminated before barrier was lifted") + case err := <-notifyHostChan: + t.Fatalf("runc has terminated before barrier was lifted (err: %v)", err) } // Lift the barrier