chore(deps): bump golangci-lint to v1.58.2 (#6719)

Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Teppei Fukuda
2024-05-20 10:35:34 +04:00
committed by GitHub
parent ff32deb7bf
commit 65b8a40d0d
9 changed files with 24 additions and 24 deletions

View File

@@ -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'

View File

@@ -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")
}
}

View File

@@ -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

View File

@@ -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...),

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}