diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 756bf94..203cf33 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 + version: v2.0.2 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 }