diff --git a/.binny.yaml b/.binny.yaml index c999fc48d..84d3368bb 100644 --- a/.binny.yaml +++ b/.binny.yaml @@ -26,7 +26,7 @@ tools: # used for linting - name: golangci-lint version: - want: v1.56.0 + want: v1.56.1 method: github-release with: repo: golangci/golangci-lint diff --git a/cmd/syft/internal/clio_setup_config.go b/cmd/syft/internal/clio_setup_config.go index d1a34a692..0127fda0a 100644 --- a/cmd/syft/internal/clio_setup_config.go +++ b/cmd/syft/internal/clio_setup_config.go @@ -48,7 +48,7 @@ func AppClioSetupConfig(id clio.Identification, out io.Writer) *clio.SetupConfig return nil }, ). - WithPostRuns(func(state *clio.State, err error) { + WithPostRuns(func(_ *clio.State, _ error) { stereoscope.Cleanup() }) return clioCfg diff --git a/cmd/syft/internal/commands/cataloger_list.go b/cmd/syft/internal/commands/cataloger_list.go index 265f26010..2cdf6e8b8 100644 --- a/cmd/syft/internal/commands/cataloger_list.go +++ b/cmd/syft/internal/commands/cataloger_list.go @@ -46,7 +46,7 @@ func CatalogerList(app clio.Application) *cobra.Command { return app.SetupCommand(&cobra.Command{ Use: "list [OPTIONS]", Short: "List available catalogers", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return runCatalogerList(opts) }, }, opts) diff --git a/cmd/syft/internal/commands/convert.go b/cmd/syft/internal/commands/convert.go index 193fe5a2b..2a1e67256 100644 --- a/cmd/syft/internal/commands/convert.go +++ b/cmd/syft/internal/commands/convert.go @@ -47,7 +47,7 @@ func Convert(app clio.Application) *cobra.Command { }), Args: validateConvertArgs, PreRunE: applicationUpdateCheck(id, &opts.UpdateCheck), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { restoreStdout := ui.CaptureStdoutToTraceLog() defer restoreStdout() diff --git a/cmd/syft/internal/commands/update.go b/cmd/syft/internal/commands/update.go index e8edf9947..27629ff49 100644 --- a/cmd/syft/internal/commands/update.go +++ b/cmd/syft/internal/commands/update.go @@ -28,7 +28,7 @@ var latestAppVersionURL = struct { } 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 { checkForApplicationUpdate(id) } diff --git a/internal/task/environment_tasks.go b/internal/task/environment_tasks.go index ab14faff1..2c988a624 100644 --- a/internal/task/environment_tasks.go +++ b/internal/task/environment_tasks.go @@ -11,7 +11,7 @@ import ( // TODO: add tui element here? 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) if release != nil { builder.SetLinuxDistribution(*release) diff --git a/internal/task/file_tasks.go b/internal/task/file_tasks.go index 8084a7b14..857f6e423 100644 --- a/internal/task/file_tasks.go +++ b/internal/task/file_tasks.go @@ -108,7 +108,7 @@ func NewExecutableCatalogerTask(selection file.Selection, cfg executable.Config) 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) result, err := cat.Catalog(resolver) diff --git a/internal/task/relationship_tasks.go b/internal/task/relationship_tasks.go index 6f4b6a16d..2732d04e8 100644 --- a/internal/task/relationship_tasks.go +++ b/internal/task/relationship_tasks.go @@ -22,7 +22,7 @@ func (s sourceIdentifierAdapter) ID() artifact.ID { } 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( builder, cfg, diff --git a/syft/internal/fileresolver/unindexed_directory.go b/syft/internal/fileresolver/unindexed_directory.go index 549b5011c..ee9e73af3 100644 --- a/syft/internal/fileresolver/unindexed_directory.go +++ b/syft/internal/fileresolver/unindexed_directory.go @@ -232,7 +232,7 @@ func (u UnindexedDirectory) AllLocations(ctx context.Context) <-chan file.Locati errWalkCanceled := fmt.Errorf("walk canceled") go func() { 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) if p == "" { return nil diff --git a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/add_snippet.go b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/add_snippet.go index f5167abf9..fbffe8b99 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/add_snippet.go +++ b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/add_snippet.go @@ -22,7 +22,7 @@ func AddSnippet(appConfig config.Application) *cobra.Command { Use: "add-snippet", Short: "capture snippets from binaries", Args: cobra.NoArgs, - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(_ *cobra.Command, _ []string) error { candidates, err := internal.ListAllBinaries(appConfig) if err != nil { return fmt.Errorf("unable to list binaries: %w", err) @@ -44,7 +44,7 @@ func AddSnippet(appConfig config.Application) *cobra.Command { return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { name, version, _, err := inferInfoFromBinaryPath(appConfig, binaryPath) if err != nil { return fmt.Errorf("unable to infer name and version from binary path: %w", err) diff --git a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/download.go b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/download.go index 81abeb1d4..5240fc6d9 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/download.go +++ b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/download.go @@ -17,7 +17,7 @@ func Download(appConfig config.Application) *cobra.Command { cmd := &cobra.Command{ Use: "download", Short: "download binaries [name@version ...]", - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(_ *cobra.Command, args []string) error { if len(args) > 0 { for _, arg := range args { binaryFromImageCfg := appConfig.GetBinaryFromImage(arg, "") @@ -40,7 +40,7 @@ func Download(appConfig config.Application) *cobra.Command { return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { for _, binaryFromImageCfg := range configs { if err := internal.DownloadFromImage(appConfig.DownloadPath, binaryFromImageCfg); err != nil { return err diff --git a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/list.go b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/list.go index b968dda36..223739d16 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/list.go +++ b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/list.go @@ -19,7 +19,7 @@ func List(appConfig config.Application) *cobra.Command { Use: "list", Short: "list managed binaries and managed/unmanaged snippets", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return runList(appConfig, showPaths) }, } diff --git a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/write_snippet.go b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/write_snippet.go index 400f7d2ea..70915be34 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/write_snippet.go +++ b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/cli/commands/write_snippet.go @@ -26,7 +26,7 @@ func WriteSnippet(appConfig config.Application) *cobra.Command { Use: "write-snippet [binary]", Short: "capture snippets from binaries", 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 != "") { 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 }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { platform, err := getPlatform(binaryPath) if err != nil { return fmt.Errorf("unable to get platform: %w", err) diff --git a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/list_entries.go b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/list_entries.go index 5c8922e4b..7d6c20630 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/manager/internal/list_entries.go +++ b/syft/pkg/cataloger/binary/test-fixtures/manager/internal/list_entries.go @@ -169,7 +169,7 @@ func getLogicalKey(managedBinaryPath string) (*LogicalEntryKey, error) { func allFilePaths(root string) ([]string, error) { 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") { paths = append(paths, path) } diff --git a/syft/pkg/cataloger/generic/cataloger.go b/syft/pkg/cataloger/generic/cataloger.go index cdfe51596..51b1cd337 100644 --- a/syft/pkg/cataloger/generic/cataloger.go +++ b/syft/pkg/cataloger/generic/cataloger.go @@ -27,7 +27,7 @@ type Cataloger struct { func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger { c.processor = append(c.processor, - func(resolver file.Resolver, env Environment) []request { + func(resolver file.Resolver, _ Environment) []request { var requests []request for _, g := range globs { 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 { c.processor = append(c.processor, - func(resolver file.Resolver, env Environment) []request { + func(resolver file.Resolver, _ Environment) []request { var requests []request log.WithFields("mimetypes", types).Trace("searching for paths matching mimetype") 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 { c.processor = append(c.processor, - func(resolver file.Resolver, env Environment) []request { + func(resolver file.Resolver, _ Environment) []request { var requests []request for _, p := range paths { log.WithFields("path", p).Trace("searching for path") diff --git a/syft/pkg/cataloger/java/package_url.go b/syft/pkg/cataloger/java/package_url.go index d03b28431..355f580e6 100644 --- a/syft/pkg/cataloger/java/package_url.go +++ b/syft/pkg/cataloger/java/package_url.go @@ -64,16 +64,16 @@ func groupIDFromJavaManifest(manifest *pkg.JavaManifest) (groupID string) { return groupID } - groupIDS := cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.PrimaryJavaManifestGroupIDFields) + groupIDs := cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.PrimaryJavaManifestGroupIDFields) // assumes that primaryJavaManifestNameFields are ordered by priority - if len(groupIDS) != 0 { - return groupIDS[0] + if len(groupIDs) != 0 { + return groupIDs[0] } - groupIDS = cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.SecondaryJavaManifestGroupIDFields) + groupIDs = cpegenerate.GetManifestFieldGroupIDs(manifest, cpegenerate.SecondaryJavaManifestGroupIDFields) - if len(groupIDS) != 0 { - return groupIDS[0] + if len(groupIDs) != 0 { + return groupIDs[0] } return groupID diff --git a/syft/source/file_source.go b/syft/source/file_source.go index c3a89668c..6fcc2f669 100644 --- a/syft/source/file_source.go +++ b/syft/source/file_source.go @@ -177,7 +177,7 @@ func (s FileSource) FileResolver(_ Scope) (file.Resolver, error) { exclusionFunctions = append([]fileresolver.PathIndexVisitor{ // 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 { // this is the root directory... always include it return nil