mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 15:50:15 -08:00
chore(deps): bump golangci-lint to v1.58.2 (#6719)
Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@@ -46,7 +46,7 @@ jobs:
|
|||||||
id: lint
|
id: lint
|
||||||
uses: golangci/golangci-lint-action@v6.0.1
|
uses: golangci/golangci-lint-action@v6.0.1
|
||||||
with:
|
with:
|
||||||
version: v1.57
|
version: v1.58
|
||||||
args: --verbose --out-format=line-number
|
args: --verbose --out-format=line-number
|
||||||
if: matrix.operating-system == 'ubuntu-latest'
|
if: matrix.operating-system == 'ubuntu-latest'
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
max = int64(10) << 30 // 10GB
|
maxSize = int64(10) << 30 // 10GB
|
||||||
blockSize = 4096
|
blockSize = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ func DecompressGzip(t *testing.T, src, dst string) {
|
|||||||
gr, err := gzip.NewReader(f)
|
gr, err := gzip.NewReader(f)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
_, err = io.CopyN(w, gr, max)
|
_, err = io.CopyN(w, gr, maxSize)
|
||||||
require.ErrorIs(t, err, io.EOF)
|
require.ErrorIs(t, err, io.EOF)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ func DecompressSparseGzip(t *testing.T, src, dst string) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
written += int64(wn)
|
written += int64(wn)
|
||||||
if written > max {
|
if written > maxSize {
|
||||||
require.Fail(t, "written size exceeds max")
|
require.Fail(t, "written size exceeds max")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func (Tool) Wire() error {
|
|||||||
|
|
||||||
// GolangciLint installs golangci-lint
|
// GolangciLint installs golangci-lint
|
||||||
func (t Tool) GolangciLint() error {
|
func (t Tool) GolangciLint() error {
|
||||||
const version = "v1.57.2"
|
const version = "v1.58.2"
|
||||||
bin := filepath.Join(GOBIN, "golangci-lint")
|
bin := filepath.Join(GOBIN, "golangci-lint")
|
||||||
if exists(bin) && t.matchGolangciLintVersion(bin, version) {
|
if exists(bin) && t.matchGolangciLintVersion(bin, version) {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ func (s *AWSScanner) Scan(ctx context.Context, option flag.Options) (scan.Result
|
|||||||
|
|
||||||
dataFS, dataPaths, err := misconf.CreateDataFS(option.RegoOptions.DataPaths)
|
dataFS, dataPaths, err := misconf.CreateDataFS(option.RegoOptions.DataPaths)
|
||||||
if err != nil {
|
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,
|
scannerOpts = append(scannerOpts,
|
||||||
options.ScannerWithDataDirs(dataPaths...),
|
options.ScannerWithDataDirs(dataPaths...),
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ func (p *Parser) parseV2(lock LockFile) ([]ftypes.Package, []ftypes.Dependency,
|
|||||||
for _, req := range lock.Requires {
|
for _, req := range lock.Requires {
|
||||||
pkg, err := toPackage(req.Dependency, req.StartLine, req.EndLine)
|
pkg, err := toPackage(req.Dependency, req.StartLine, req.EndLine)
|
||||||
if err != nil {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ func maxInt(args []int) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
max := args[0]
|
maxN := args[0]
|
||||||
|
|
||||||
for i := 1; i < len(args); i++ {
|
for i := 1; i < len(args); i++ {
|
||||||
if args[i] > max {
|
if args[i] > maxN {
|
||||||
max = args[i]
|
maxN = args[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max
|
return maxN
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ func minInt(args []int) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
min := args[0]
|
minN := args[0]
|
||||||
|
|
||||||
for i := 1; i < len(args); i++ {
|
for i := 1; i < len(args); i++ {
|
||||||
if args[i] < min {
|
if args[i] < minN {
|
||||||
min = args[i]
|
minN = args[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return min
|
return minN
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,19 +98,19 @@ func (r *ManifestNode) UnmarshalYAML(node *yaml.Node) error {
|
|||||||
|
|
||||||
func (r *ManifestNode) handleSliceTag(node *yaml.Node) error {
|
func (r *ManifestNode) handleSliceTag(node *yaml.Node) error {
|
||||||
var nodes []ManifestNode
|
var nodes []ManifestNode
|
||||||
max := node.Line
|
maxLine := node.Line
|
||||||
for _, contentNode := range node.Content {
|
for _, contentNode := range node.Content {
|
||||||
newNode := new(ManifestNode)
|
newNode := new(ManifestNode)
|
||||||
newNode.Path = r.Path
|
newNode.Path = r.Path
|
||||||
if err := contentNode.Decode(newNode); err != nil {
|
if err := contentNode.Decode(newNode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if newNode.EndLine > max {
|
if newNode.EndLine > maxLine {
|
||||||
max = newNode.EndLine
|
maxLine = newNode.EndLine
|
||||||
}
|
}
|
||||||
nodes = append(nodes, *newNode)
|
nodes = append(nodes, *newNode)
|
||||||
}
|
}
|
||||||
r.EndLine = max
|
r.EndLine = maxLine
|
||||||
r.Value = nodes
|
r.Value = nodes
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ func (r *ManifestNode) handleSliceTag(node *yaml.Node) error {
|
|||||||
func (r *ManifestNode) handleMapTag(node *yaml.Node) error {
|
func (r *ManifestNode) handleMapTag(node *yaml.Node) error {
|
||||||
output := make(map[string]ManifestNode)
|
output := make(map[string]ManifestNode)
|
||||||
var key string
|
var key string
|
||||||
max := node.Line
|
maxLine := node.Line
|
||||||
for i, contentNode := range node.Content {
|
for i, contentNode := range node.Content {
|
||||||
if i == 0 || i%2 == 0 {
|
if i == 0 || i%2 == 0 {
|
||||||
key = contentNode.Value
|
key = contentNode.Value
|
||||||
@@ -129,12 +129,12 @@ func (r *ManifestNode) handleMapTag(node *yaml.Node) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
output[key] = *newNode
|
output[key] = *newNode
|
||||||
if newNode.EndLine > max {
|
if newNode.EndLine > maxLine {
|
||||||
max = newNode.EndLine
|
maxLine = newNode.EndLine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.EndLine = max
|
r.EndLine = maxLine
|
||||||
r.Value = output
|
r.Value = output
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.")
|
m.logger.WarnContext(ctx, "The plugin index is not found. Please run 'trivy plugin update' to download the index.")
|
||||||
return name
|
return name
|
||||||
} else if err != nil {
|
} 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
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user