mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
chore(deps): update tools to latest versions (#2616)
* chore(deps): update tools to latest versions Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: update to new linter rules Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com> Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
parent
3ac7369068
commit
17ef243956
@ -26,7 +26,7 @@ tools:
|
|||||||
# used for linting
|
# used for linting
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
version:
|
version:
|
||||||
want: v1.56.0
|
want: v1.56.1
|
||||||
method: github-release
|
method: github-release
|
||||||
with:
|
with:
|
||||||
repo: golangci/golangci-lint
|
repo: golangci/golangci-lint
|
||||||
|
|||||||
@ -48,7 +48,7 @@ func AppClioSetupConfig(id clio.Identification, out io.Writer) *clio.SetupConfig
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
).
|
).
|
||||||
WithPostRuns(func(state *clio.State, err error) {
|
WithPostRuns(func(_ *clio.State, _ error) {
|
||||||
stereoscope.Cleanup()
|
stereoscope.Cleanup()
|
||||||
})
|
})
|
||||||
return clioCfg
|
return clioCfg
|
||||||
|
|||||||
@ -46,7 +46,7 @@ func CatalogerList(app clio.Application) *cobra.Command {
|
|||||||
return app.SetupCommand(&cobra.Command{
|
return app.SetupCommand(&cobra.Command{
|
||||||
Use: "list [OPTIONS]",
|
Use: "list [OPTIONS]",
|
||||||
Short: "List available catalogers",
|
Short: "List available catalogers",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
return runCatalogerList(opts)
|
return runCatalogerList(opts)
|
||||||
},
|
},
|
||||||
}, opts)
|
}, opts)
|
||||||
|
|||||||
@ -47,7 +47,7 @@ func Convert(app clio.Application) *cobra.Command {
|
|||||||
}),
|
}),
|
||||||
Args: validateConvertArgs,
|
Args: validateConvertArgs,
|
||||||
PreRunE: applicationUpdateCheck(id, &opts.UpdateCheck),
|
PreRunE: applicationUpdateCheck(id, &opts.UpdateCheck),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, args []string) error {
|
||||||
restoreStdout := ui.CaptureStdoutToTraceLog()
|
restoreStdout := ui.CaptureStdoutToTraceLog()
|
||||||
defer restoreStdout()
|
defer restoreStdout()
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ var latestAppVersionURL = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func applicationUpdateCheck(id clio.Identification, check *options.UpdateCheck) func(cmd *cobra.Command, args []string) error {
|
func applicationUpdateCheck(id clio.Identification, check *options.UpdateCheck) func(cmd *cobra.Command, args []string) error {
|
||||||
return func(cmd *cobra.Command, args []string) error {
|
return func(_ *cobra.Command, _ []string) error {
|
||||||
if check.CheckForAppUpdate {
|
if check.CheckForAppUpdate {
|
||||||
checkForApplicationUpdate(id)
|
checkForApplicationUpdate(id)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
// TODO: add tui element here?
|
// TODO: add tui element here?
|
||||||
|
|
||||||
func NewEnvironmentTask() Task {
|
func NewEnvironmentTask() Task {
|
||||||
fn := func(ctx context.Context, resolver file.Resolver, builder sbomsync.Builder) error {
|
fn := func(_ context.Context, resolver file.Resolver, builder sbomsync.Builder) error {
|
||||||
release := linux.IdentifyRelease(resolver)
|
release := linux.IdentifyRelease(resolver)
|
||||||
if release != nil {
|
if release != nil {
|
||||||
builder.SetLinuxDistribution(*release)
|
builder.SetLinuxDistribution(*release)
|
||||||
|
|||||||
@ -108,7 +108,7 @@ func NewExecutableCatalogerTask(selection file.Selection, cfg executable.Config)
|
|||||||
|
|
||||||
cat := executable.NewCataloger(cfg)
|
cat := executable.NewCataloger(cfg)
|
||||||
|
|
||||||
fn := func(ctx context.Context, resolver file.Resolver, builder sbomsync.Builder) error {
|
fn := func(_ context.Context, resolver file.Resolver, builder sbomsync.Builder) error {
|
||||||
accessor := builder.(sbomsync.Accessor)
|
accessor := builder.(sbomsync.Accessor)
|
||||||
|
|
||||||
result, err := cat.Catalog(resolver)
|
result, err := cat.Catalog(resolver)
|
||||||
|
|||||||
@ -22,7 +22,7 @@ func (s sourceIdentifierAdapter) ID() artifact.ID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task {
|
func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task {
|
||||||
fn := func(ctx context.Context, resolver file.Resolver, builder sbomsync.Builder) error {
|
fn := func(_ context.Context, _ file.Resolver, builder sbomsync.Builder) error {
|
||||||
relationship.Finalize(
|
relationship.Finalize(
|
||||||
builder,
|
builder,
|
||||||
cfg,
|
cfg,
|
||||||
|
|||||||
@ -232,7 +232,7 @@ func (u UnindexedDirectory) AllLocations(ctx context.Context) <-chan file.Locati
|
|||||||
errWalkCanceled := fmt.Errorf("walk canceled")
|
errWalkCanceled := fmt.Errorf("walk canceled")
|
||||||
go func() {
|
go func() {
|
||||||
defer close(out)
|
defer close(out)
|
||||||
err := afero.Walk(u.fs, u.absPath("."), func(p string, info fs.FileInfo, err error) error {
|
err := afero.Walk(u.fs, u.absPath("."), func(p string, _ fs.FileInfo, _ error) error {
|
||||||
p = strings.TrimPrefix(p, u.dir)
|
p = strings.TrimPrefix(p, u.dir)
|
||||||
if p == "" {
|
if p == "" {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -22,7 +22,7 @@ func AddSnippet(appConfig config.Application) *cobra.Command {
|
|||||||
Use: "add-snippet",
|
Use: "add-snippet",
|
||||||
Short: "capture snippets from binaries",
|
Short: "capture snippets from binaries",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
PreRunE: func(_ *cobra.Command, _ []string) error {
|
||||||
candidates, err := internal.ListAllBinaries(appConfig)
|
candidates, err := internal.ListAllBinaries(appConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to list binaries: %w", err)
|
return fmt.Errorf("unable to list binaries: %w", err)
|
||||||
@ -44,7 +44,7 @@ func AddSnippet(appConfig config.Application) *cobra.Command {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
name, version, _, err := inferInfoFromBinaryPath(appConfig, binaryPath)
|
name, version, _, err := inferInfoFromBinaryPath(appConfig, binaryPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to infer name and version from binary path: %w", err)
|
return fmt.Errorf("unable to infer name and version from binary path: %w", err)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ func Download(appConfig config.Application) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "download",
|
Use: "download",
|
||||||
Short: "download binaries [name@version ...]",
|
Short: "download binaries [name@version ...]",
|
||||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
PreRunE: func(_ *cobra.Command, args []string) error {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
binaryFromImageCfg := appConfig.GetBinaryFromImage(arg, "")
|
binaryFromImageCfg := appConfig.GetBinaryFromImage(arg, "")
|
||||||
@ -40,7 +40,7 @@ func Download(appConfig config.Application) *cobra.Command {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
for _, binaryFromImageCfg := range configs {
|
for _, binaryFromImageCfg := range configs {
|
||||||
if err := internal.DownloadFromImage(appConfig.DownloadPath, binaryFromImageCfg); err != nil {
|
if err := internal.DownloadFromImage(appConfig.DownloadPath, binaryFromImageCfg); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -19,7 +19,7 @@ func List(appConfig config.Application) *cobra.Command {
|
|||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "list managed binaries and managed/unmanaged snippets",
|
Short: "list managed binaries and managed/unmanaged snippets",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
return runList(appConfig, showPaths)
|
return runList(appConfig, showPaths)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ func WriteSnippet(appConfig config.Application) *cobra.Command {
|
|||||||
Use: "write-snippet [binary]",
|
Use: "write-snippet [binary]",
|
||||||
Short: "capture snippets from binaries",
|
Short: "capture snippets from binaries",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
PreRunE: func(_ *cobra.Command, args []string) error {
|
||||||
if len(args) == 0 && (name != "" || version != "") {
|
if len(args) == 0 && (name != "" || version != "") {
|
||||||
return fmt.Errorf("cannot provide name or version without a binary path")
|
return fmt.Errorf("cannot provide name or version without a binary path")
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ func WriteSnippet(appConfig config.Application) *cobra.Command {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
platform, err := getPlatform(binaryPath)
|
platform, err := getPlatform(binaryPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to get platform: %w", err)
|
return fmt.Errorf("unable to get platform: %w", err)
|
||||||
|
|||||||
@ -169,7 +169,7 @@ func getLogicalKey(managedBinaryPath string) (*LogicalEntryKey, error) {
|
|||||||
|
|
||||||
func allFilePaths(root string) ([]string, error) {
|
func allFilePaths(root string) ([]string, error) {
|
||||||
var paths []string
|
var paths []string
|
||||||
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
err := filepath.Walk(root, func(path string, info os.FileInfo, _ error) error {
|
||||||
if info != nil && !info.IsDir() && !strings.HasSuffix(path, ".fingerprint") {
|
if info != nil && !info.IsDir() && !strings.HasSuffix(path, ".fingerprint") {
|
||||||
paths = append(paths, path)
|
paths = append(paths, path)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ type Cataloger struct {
|
|||||||
|
|
||||||
func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger {
|
func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger {
|
||||||
c.processor = append(c.processor,
|
c.processor = append(c.processor,
|
||||||
func(resolver file.Resolver, env Environment) []request {
|
func(resolver file.Resolver, _ Environment) []request {
|
||||||
var requests []request
|
var requests []request
|
||||||
for _, g := range globs {
|
for _, g := range globs {
|
||||||
log.WithFields("glob", g).Trace("searching for paths matching glob")
|
log.WithFields("glob", g).Trace("searching for paths matching glob")
|
||||||
@ -47,7 +47,7 @@ func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger
|
|||||||
|
|
||||||
func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Cataloger {
|
func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Cataloger {
|
||||||
c.processor = append(c.processor,
|
c.processor = append(c.processor,
|
||||||
func(resolver file.Resolver, env Environment) []request {
|
func(resolver file.Resolver, _ Environment) []request {
|
||||||
var requests []request
|
var requests []request
|
||||||
log.WithFields("mimetypes", types).Trace("searching for paths matching mimetype")
|
log.WithFields("mimetypes", types).Trace("searching for paths matching mimetype")
|
||||||
matches, err := resolver.FilesByMIMEType(types...)
|
matches, err := resolver.FilesByMIMEType(types...)
|
||||||
@ -64,7 +64,7 @@ func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Catal
|
|||||||
|
|
||||||
func (c *Cataloger) WithParserByPath(parser Parser, paths ...string) *Cataloger {
|
func (c *Cataloger) WithParserByPath(parser Parser, paths ...string) *Cataloger {
|
||||||
c.processor = append(c.processor,
|
c.processor = append(c.processor,
|
||||||
func(resolver file.Resolver, env Environment) []request {
|
func(resolver file.Resolver, _ Environment) []request {
|
||||||
var requests []request
|
var requests []request
|
||||||
for _, p := range paths {
|
for _, p := range paths {
|
||||||
log.WithFields("path", p).Trace("searching for path")
|
log.WithFields("path", p).Trace("searching for path")
|
||||||
|
|||||||
@ -64,16 +64,16 @@ func groupIDFromJavaManifest(manifest *pkg.JavaManifest) (groupID string) {
|
|||||||
return groupID
|
return groupID
|
||||||
}
|
}
|
||||||
|
|
||||||
groupIDS := cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.PrimaryJavaManifestGroupIDFields)
|
groupIDs := cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.PrimaryJavaManifestGroupIDFields)
|
||||||
// assumes that primaryJavaManifestNameFields are ordered by priority
|
// assumes that primaryJavaManifestNameFields are ordered by priority
|
||||||
if len(groupIDS) != 0 {
|
if len(groupIDs) != 0 {
|
||||||
return groupIDS[0]
|
return groupIDs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
groupIDS = cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.SecondaryJavaManifestGroupIDFields)
|
groupIDs = cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.SecondaryJavaManifestGroupIDFields)
|
||||||
|
|
||||||
if len(groupIDS) != 0 {
|
if len(groupIDs) != 0 {
|
||||||
return groupIDS[0]
|
return groupIDs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
return groupID
|
return groupID
|
||||||
|
|||||||
@ -177,7 +177,7 @@ func (s FileSource) FileResolver(_ Scope) (file.Resolver, error) {
|
|||||||
exclusionFunctions = append([]fileresolver.PathIndexVisitor{
|
exclusionFunctions = append([]fileresolver.PathIndexVisitor{
|
||||||
|
|
||||||
// note: we should exclude these kinds of paths first before considering any other user-provided exclusions
|
// note: we should exclude these kinds of paths first before considering any other user-provided exclusions
|
||||||
func(p string, info os.FileInfo, err error) error {
|
func(p string, _ os.FileInfo, _ error) error {
|
||||||
if p == absParentDir {
|
if p == absParentDir {
|
||||||
// this is the root directory... always include it
|
// this is the root directory... always include it
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user