From 51a664cb4a419658fde9ae8ddb87c63d18f0d3bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:39:07 +0000 Subject: [PATCH 1/3] Bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 756bf94..5f6aef6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,6 +24,6 @@ jobs: with: go-version: stable - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: version: v1.64.5 From f1122ea12a28535a65eaf410cb1ac1a0666529df Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 4 Apr 2025 16:06:25 +0200 Subject: [PATCH 2/3] Bump golangci-lint version in action to v2.0.2 Signed-off-by: Evan Lezar --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5f6aef6..203cf33 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,4 +26,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v7 with: - version: v1.64.5 + version: v2.0.2 From 24147ba9b75bd122f12105c705b894fca0ae4832 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 4 Apr 2025 16:10:51 +0200 Subject: [PATCH 3/3] Address golangci-lint v2.0.2 errors Signed-off-by: Evan Lezar --- pkg/cdi/cache.go | 2 +- pkg/cdi/cache_linux_test.go | 2 +- pkg/cdi/cache_test.go | 2 +- pkg/cdi/regressions_test.go | 4 +++- pkg/cdi/spec-dirs_test.go | 2 +- pkg/cdi/spec.go | 4 ++-- pkg/cdi/spec_linux.go | 4 +++- pkg/cdi/spec_test.go | 4 ++-- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/cdi/cache.go b/pkg/cdi/cache.go index 7095f27..ba817a5 100644 --- a/pkg/cdi/cache.go +++ b/pkg/cdi/cache.go @@ -520,7 +520,7 @@ func (w *watch) stop() { return } - w.watcher.Close() + _ = w.watcher.Close() w.tracked = nil } diff --git a/pkg/cdi/cache_linux_test.go b/pkg/cdi/cache_linux_test.go index 9eda4bd..b78f413 100644 --- a/pkg/cdi/cache_linux_test.go +++ b/pkg/cdi/cache_linux_test.go @@ -229,7 +229,7 @@ func (em *emfile) undo() error { return err } for _, fd := range em.fds { - syscall.Close(fd) + _ = syscall.Close(fd) } em.undone = true diff --git a/pkg/cdi/cache_test.go b/pkg/cdi/cache_test.go index 594785d..951848a 100644 --- a/pkg/cdi/cache_test.go +++ b/pkg/cdi/cache_test.go @@ -1860,7 +1860,7 @@ func updateSpecDirs(dir string, etc, run map[string]string) error { path := filepath.Join(dir, sub) for name, data := range entries { if data == "remove" { - os.Remove(filepath.Join(path, name)) + _ = os.Remove(filepath.Join(path, name)) } else { updates[sub][name] = data } diff --git a/pkg/cdi/regressions_test.go b/pkg/cdi/regressions_test.go index e080eb8..ba2880e 100644 --- a/pkg/cdi/regressions_test.go +++ b/pkg/cdi/regressions_test.go @@ -111,7 +111,9 @@ containerEdits: cdiDir, err := writeFilesToTempDir("containerd-test-CDI-injections-", test.cdiSpecFiles) if cdiDir != "" { - defer os.RemoveAll(cdiDir) + defer func() { + _ = os.RemoveAll(cdiDir) + }() } require.NoError(t, err) diff --git a/pkg/cdi/spec-dirs_test.go b/pkg/cdi/spec-dirs_test.go index 5739fee..c4bf881 100644 --- a/pkg/cdi/spec-dirs_test.go +++ b/pkg/cdi/spec-dirs_test.go @@ -216,7 +216,7 @@ func mkTestDir(t *testing.T, dirs map[string]map[string]string) (string, error) } t.Cleanup(func() { - os.RemoveAll(tmp) + _ = os.RemoveAll(tmp) }) if err = updateTestDir(tmp, dirs); err != nil { diff --git a/pkg/cdi/spec.go b/pkg/cdi/spec.go index 8d295a8..fdaa268 100644 --- a/pkg/cdi/spec.go +++ b/pkg/cdi/spec.go @@ -156,7 +156,7 @@ func (s *Spec) write(overwrite bool) error { return fmt.Errorf("failed to create Spec file: %w", err) } _, err = tmp.Write(data) - tmp.Close() + _ = tmp.Close() if err != nil { return fmt.Errorf("failed to write Spec file: %w", err) } @@ -164,7 +164,7 @@ func (s *Spec) write(overwrite bool) error { err = renameIn(dir, filepath.Base(tmp.Name()), filepath.Base(s.path), overwrite) if err != nil { - os.Remove(tmp.Name()) + _ = os.Remove(tmp.Name()) err = fmt.Errorf("failed to write Spec file: %w", err) } diff --git a/pkg/cdi/spec_linux.go b/pkg/cdi/spec_linux.go index 9ad2739..88fd9bb 100644 --- a/pkg/cdi/spec_linux.go +++ b/pkg/cdi/spec_linux.go @@ -32,7 +32,9 @@ func renameIn(dir, src, dst string, overwrite bool) error { if err != nil { return fmt.Errorf("rename failed: %w", err) } - defer dirf.Close() + defer func() { + _ = dirf.Close() + }() if !overwrite { flags = unix.RENAME_NOREPLACE diff --git a/pkg/cdi/spec_test.go b/pkg/cdi/spec_test.go index 89028ac..1bc339e 100644 --- a/pkg/cdi/spec_test.go +++ b/pkg/cdi/spec_test.go @@ -504,10 +504,10 @@ func mkTestSpec(t *testing.T, data []byte) (string, error) { file := tmp.Name() t.Cleanup(func() { - os.Remove(file) + _ = os.Remove(file) }) - tmp.Close() + _ = tmp.Close() return file, nil }