From 65b8a40d0daa9bba904ae8b4667a7d12a8017750 Mon Sep 17 00:00:00 2001 From: Teppei Fukuda Date: Mon, 20 May 2024 10:35:34 +0400 Subject: [PATCH] chore(deps): bump golangci-lint to v1.58.2 (#6719) Signed-off-by: knqyf263 --- .github/workflows/test.yaml | 2 +- internal/testutil/gzip.go | 6 +++--- magefiles/magefile.go | 2 +- pkg/cloud/aws/scanner/scanner.go | 2 +- pkg/dependency/parser/c/conan/parse.go | 2 +- pkg/iac/scanners/azure/functions/max.go | 8 ++++---- pkg/iac/scanners/azure/functions/min.go | 8 ++++---- .../scanners/kubernetes/parser/manifest_node.go | 16 ++++++++-------- pkg/plugin/index.go | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b42b2b517a..59f27efc1b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,7 +46,7 @@ jobs: id: lint uses: golangci/golangci-lint-action@v6.0.1 with: - version: v1.57 + version: v1.58 args: --verbose --out-format=line-number if: matrix.operating-system == 'ubuntu-latest' diff --git a/internal/testutil/gzip.go b/internal/testutil/gzip.go index 6f417e326a..68e97395cb 100644 --- a/internal/testutil/gzip.go +++ b/internal/testutil/gzip.go @@ -11,7 +11,7 @@ import ( ) const ( - max = int64(10) << 30 // 10GB + maxSize = int64(10) << 30 // 10GB blockSize = 4096 ) @@ -27,7 +27,7 @@ func DecompressGzip(t *testing.T, src, dst string) { gr, err := gzip.NewReader(f) require.NoError(t, err) - _, err = io.CopyN(w, gr, max) + _, err = io.CopyN(w, gr, maxSize) require.ErrorIs(t, err, io.EOF) } @@ -69,7 +69,7 @@ func DecompressSparseGzip(t *testing.T, src, dst string) { require.NoError(t, err) } written += int64(wn) - if written > max { + if written > maxSize { require.Fail(t, "written size exceeds max") } } diff --git a/magefiles/magefile.go b/magefiles/magefile.go index 6fa5e643b3..2df15c4ed6 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -71,7 +71,7 @@ func (Tool) Wire() error { // GolangciLint installs golangci-lint func (t Tool) GolangciLint() error { - const version = "v1.57.2" + const version = "v1.58.2" bin := filepath.Join(GOBIN, "golangci-lint") if exists(bin) && t.matchGolangciLintVersion(bin, version) { return nil diff --git a/pkg/cloud/aws/scanner/scanner.go b/pkg/cloud/aws/scanner/scanner.go index fcbabe0d85..6ea5f919f2 100644 --- a/pkg/cloud/aws/scanner/scanner.go +++ b/pkg/cloud/aws/scanner/scanner.go @@ -99,7 +99,7 @@ func (s *AWSScanner) Scan(ctx context.Context, option flag.Options) (scan.Result dataFS, dataPaths, err := misconf.CreateDataFS(option.RegoOptions.DataPaths) if err != nil { - s.logger.Error("Could not load config data", err) + s.logger.Error("Could not load config data", log.Err(err)) } scannerOpts = append(scannerOpts, options.ScannerWithDataDirs(dataPaths...), diff --git a/pkg/dependency/parser/c/conan/parse.go b/pkg/dependency/parser/c/conan/parse.go index 4528da67b7..7661131ec8 100644 --- a/pkg/dependency/parser/c/conan/parse.go +++ b/pkg/dependency/parser/c/conan/parse.go @@ -107,7 +107,7 @@ func (p *Parser) parseV2(lock LockFile) ([]ftypes.Package, []ftypes.Dependency, for _, req := range lock.Requires { pkg, err := toPackage(req.Dependency, req.StartLine, req.EndLine) if err != nil { - p.logger.Debug("Creating package entry from requirement failed", err) + p.logger.Debug("Creating package entry from requirement failed", log.Err(err)) continue } diff --git a/pkg/iac/scanners/azure/functions/max.go b/pkg/iac/scanners/azure/functions/max.go index eb0338a4f8..b28ddb436c 100644 --- a/pkg/iac/scanners/azure/functions/max.go +++ b/pkg/iac/scanners/azure/functions/max.go @@ -21,12 +21,12 @@ func maxInt(args []int) int { return 0 } - max := args[0] + maxN := args[0] for i := 1; i < len(args); i++ { - if args[i] > max { - max = args[i] + if args[i] > maxN { + maxN = args[i] } } - return max + return maxN } diff --git a/pkg/iac/scanners/azure/functions/min.go b/pkg/iac/scanners/azure/functions/min.go index 5147c3bb27..5c0d633322 100644 --- a/pkg/iac/scanners/azure/functions/min.go +++ b/pkg/iac/scanners/azure/functions/min.go @@ -21,12 +21,12 @@ func minInt(args []int) int { return 0 } - min := args[0] + minN := args[0] for i := 1; i < len(args); i++ { - if args[i] < min { - min = args[i] + if args[i] < minN { + minN = args[i] } } - return min + return minN } diff --git a/pkg/iac/scanners/kubernetes/parser/manifest_node.go b/pkg/iac/scanners/kubernetes/parser/manifest_node.go index 1f82ca1e36..17111e70b1 100644 --- a/pkg/iac/scanners/kubernetes/parser/manifest_node.go +++ b/pkg/iac/scanners/kubernetes/parser/manifest_node.go @@ -98,19 +98,19 @@ func (r *ManifestNode) UnmarshalYAML(node *yaml.Node) error { func (r *ManifestNode) handleSliceTag(node *yaml.Node) error { var nodes []ManifestNode - max := node.Line + maxLine := node.Line for _, contentNode := range node.Content { newNode := new(ManifestNode) newNode.Path = r.Path if err := contentNode.Decode(newNode); err != nil { return err } - if newNode.EndLine > max { - max = newNode.EndLine + if newNode.EndLine > maxLine { + maxLine = newNode.EndLine } nodes = append(nodes, *newNode) } - r.EndLine = max + r.EndLine = maxLine r.Value = nodes return nil } @@ -118,7 +118,7 @@ func (r *ManifestNode) handleSliceTag(node *yaml.Node) error { func (r *ManifestNode) handleMapTag(node *yaml.Node) error { output := make(map[string]ManifestNode) var key string - max := node.Line + maxLine := node.Line for i, contentNode := range node.Content { if i == 0 || i%2 == 0 { key = contentNode.Value @@ -129,12 +129,12 @@ func (r *ManifestNode) handleMapTag(node *yaml.Node) error { return err } output[key] = *newNode - if newNode.EndLine > max { - max = newNode.EndLine + if newNode.EndLine > maxLine { + maxLine = newNode.EndLine } } } - r.EndLine = max + r.EndLine = maxLine r.Value = output return nil } diff --git a/pkg/plugin/index.go b/pkg/plugin/index.go index 980d4ef1e4..d0df12e203 100644 --- a/pkg/plugin/index.go +++ b/pkg/plugin/index.go @@ -83,7 +83,7 @@ func (m *Manager) tryIndex(ctx context.Context, name string) string { m.logger.WarnContext(ctx, "The plugin index is not found. Please run 'trivy plugin update' to download the index.") return name } else if err != nil { - m.logger.ErrorContext(ctx, "Unable to load the plugin index: %w", err) + m.logger.ErrorContext(ctx, "Unable to load the plugin index", log.Err(err)) return name }