diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 05edadf93331..c2af5eb66bbb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -42,7 +42,7 @@ jobs: id: lint uses: golangci/golangci-lint-action@v6.0.1 with: - version: v1.59 + version: v1.61 args: --verbose --out-format=line-number if: matrix.operating-system == 'ubuntu-latest' diff --git a/.golangci.yaml b/.golangci.yaml index 40bfa36e1a64..b6dbc299be20 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -68,6 +68,7 @@ linters-settings: excludes: - G101 - G114 + - G115 - G204 - G304 - G402 diff --git a/magefiles/magefile.go b/magefiles/magefile.go index f70491bce2e8..5b08e907f0c0 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -77,7 +77,7 @@ func (Tool) Wire() error { // GolangciLint installs golangci-lint func (t Tool) GolangciLint() error { - const version = "v1.59.1" + const version = "v1.61.0" bin := filepath.Join(GOBIN, "golangci-lint") if exists(bin) && t.matchGolangciLintVersion(bin, version) { return nil diff --git a/pkg/fanal/walker/walk_test.go b/pkg/fanal/walker/walk_test.go index 09d55527c0fe..3c066529393f 100644 --- a/pkg/fanal/walker/walk_test.go +++ b/pkg/fanal/walker/walk_test.go @@ -1,7 +1,6 @@ package walker_test import ( - "fmt" "path/filepath" "testing" @@ -42,8 +41,11 @@ func TestSkipFile(t *testing.T) { }, }, { - name: "multiple skip files", - skipFiles: []string{"/etc/*/*", "/var/log/*.txt"}, + name: "multiple skip files", + skipFiles: []string{ + "/etc/*/*", + "/var/log/*.txt", + }, wants: map[string]bool{ "/etc/foo": false, "/etc/foo/bar": true, @@ -65,7 +67,7 @@ func TestSkipFile(t *testing.T) { for file, want := range tt.wants { file = filepath.ToSlash(filepath.Clean(file)) got := utils.SkipPath(file, utils.CleanSkipPaths(tt.skipFiles)) - assert.Equal(t, want, got, fmt.Sprintf("skipFiles: %s, file: %s", tt.skipFiles, file)) + assert.Equal(t, want, got, "skipFiles: %s, file: %s", tt.skipFiles, file) } }) } @@ -108,8 +110,11 @@ func TestSkipDir(t *testing.T) { }, }, { - name: "multiple dirs", - skipDirs: []string{"/etc/*/*", "/var/log/*"}, + name: "multiple dirs", + skipDirs: []string{ + "/etc/*/*", + "/var/log/*", + }, wants: map[string]bool{ "/etc/foo": false, "/etc/foo/bar": true, @@ -139,7 +144,7 @@ func TestSkipDir(t *testing.T) { for dir, want := range tt.wants { dir = filepath.ToSlash(filepath.Clean(dir)) got := utils.SkipPath(dir, utils.CleanSkipPaths(tt.skipDirs)) - assert.Equal(t, want, got, fmt.Sprintf("defaultSkipDirs: %s, dir: %s", tt.skipDirs, dir)) + assert.Equal(t, want, got, "defaultSkipDirs: %s, dir: %s", tt.skipDirs, dir) } }) } diff --git a/pkg/plugin/index.go b/pkg/plugin/index.go index 57c6f0260877..82e4cb076356 100644 --- a/pkg/plugin/index.go +++ b/pkg/plugin/index.go @@ -61,7 +61,7 @@ func (m *Manager) Search(ctx context.Context, keyword string) error { } } - if _, err = fmt.Fprintf(m.w, buf.String()); err != nil { + if _, err = fmt.Fprint(m.w, buf.String()); err != nil { return err }