From 4b7ae0ed3b8f41dbaf03b14c1af4db3d26a8c5bb Mon Sep 17 00:00:00 2001 From: "anchore-actions-token-generator[bot]" <102182147+anchore-actions-token-generator[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:56:36 +0000 Subject: [PATCH] chore(deps): update tools to latest versions (#3121) * chore(deps): update tools to latest versions Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: update code to reflect new linter settings for error messages Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com> --- .binny.yaml | 4 ++-- cmd/syft/internal/commands/scan.go | 2 +- internal/cache/error_resolver.go | 2 +- syft/internal/packagemetadata/discover_type_names.go | 3 ++- syft/internal/sourcemetadata/discover_type_names.go | 3 ++- syft/pkg/cataloger/cpp/parse_conanfile.go | 2 +- syft/pkg/cataloger/cpp/parse_conaninfo.go | 2 +- syft/pkg/cataloger/elixir/parse_mix_lock.go | 2 +- syft/pkg/cataloger/haskell/parse_cabal_freeze.go | 2 +- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.binny.yaml b/.binny.yaml index 42ea5c760d2..686e946ecee 100644 --- a/.binny.yaml +++ b/.binny.yaml @@ -26,7 +26,7 @@ tools: # used for linting - name: golangci-lint version: - want: v1.59.1 + want: v1.60.1 method: github-release with: repo: golangci/golangci-lint @@ -58,7 +58,7 @@ tools: # used to release all artifacts - name: goreleaser version: - want: v2.1.0 + want: v2.2.0 method: github-release with: repo: goreleaser/goreleaser diff --git a/cmd/syft/internal/commands/scan.go b/cmd/syft/internal/commands/scan.go index ff5b4254f65..efec9dd5b7d 100644 --- a/cmd/syft/internal/commands/scan.go +++ b/cmd/syft/internal/commands/scan.go @@ -161,7 +161,7 @@ func validateArgs(cmd *cobra.Command, args []string, error string) error { if err := cmd.Help(); err != nil { return fmt.Errorf("unable to display help: %w", err) } - return fmt.Errorf(error) + return fmt.Errorf("%v", error) } return cobra.MaximumNArgs(1)(cmd, args) diff --git a/internal/cache/error_resolver.go b/internal/cache/error_resolver.go index 614d707f1fa..efbf915aa50 100644 --- a/internal/cache/error_resolver.go +++ b/internal/cache/error_resolver.go @@ -34,7 +34,7 @@ func (r *errorResolver[T]) Resolve(key string, resolver resolverFunc[T]) (T, err return v.Value, err } if v.Error != "" { - return v.Value, fmt.Errorf(v.Error) + return v.Value, fmt.Errorf("failed to resolve cache: %s", v.Error) } return v.Value, nil } diff --git a/syft/internal/packagemetadata/discover_type_names.go b/syft/internal/packagemetadata/discover_type_names.go index ca9b2c9ddc5..03f8a4cc62b 100644 --- a/syft/internal/packagemetadata/discover_type_names.go +++ b/syft/internal/packagemetadata/discover_type_names.go @@ -78,7 +78,8 @@ func findMetadataDefinitionNames(paths ...string) ([]string, error) { // note: 35 is a point-in-time gut check. This number could be updated if new metadata definitions are added, but is not required. // it is really intended to catch any major issues with the generation process that would generate, say, 0 definitions. if len(strNames) < 35 { - return nil, fmt.Errorf("not enough metadata definitions found (discovered: " + fmt.Sprintf("%d", len(strNames)) + ")") + msg := fmt.Sprintf("not enough metadata definitions found (discovered %d)", len(strNames)) + return nil, fmt.Errorf("%v", msg) } return strNames, nil diff --git a/syft/internal/sourcemetadata/discover_type_names.go b/syft/internal/sourcemetadata/discover_type_names.go index 9b1ac2f5843..905de200aa4 100644 --- a/syft/internal/sourcemetadata/discover_type_names.go +++ b/syft/internal/sourcemetadata/discover_type_names.go @@ -68,7 +68,8 @@ func findMetadataDefinitionNames(paths ...string) ([]string, error) { // note: 3 is a point-in-time gut check. This number could be updated if new metadata definitions are added, but is not required. // it is really intended to catch any major issues with the generation process that would generate, say, 0 definitions. if len(strNames) < 3 { - return nil, fmt.Errorf("not enough metadata definitions found (discovered: " + fmt.Sprintf("%d", len(strNames)) + ")") + msg := fmt.Sprintf("not enough metadata definitions found (discovered %d)", len(strNames)) + return nil, fmt.Errorf("%v", msg) } return strNames, nil diff --git a/syft/pkg/cataloger/cpp/parse_conanfile.go b/syft/pkg/cataloger/cpp/parse_conanfile.go index dc22f80bdce..622acbdcb3c 100644 --- a/syft/pkg/cataloger/cpp/parse_conanfile.go +++ b/syft/pkg/cataloger/cpp/parse_conanfile.go @@ -24,7 +24,7 @@ func parseConanfile(_ context.Context, _ file.Resolver, _ *generic.Environment, for { line, err := r.ReadString('\n') switch { - case errors.Is(io.EOF, err): + case errors.Is(err, io.EOF): return pkgs, nil, nil case err != nil: return nil, nil, fmt.Errorf("failed to parse conanfile.txt file: %w", err) diff --git a/syft/pkg/cataloger/cpp/parse_conaninfo.go b/syft/pkg/cataloger/cpp/parse_conaninfo.go index 7140e47c980..8094b3406c7 100644 --- a/syft/pkg/cataloger/cpp/parse_conaninfo.go +++ b/syft/pkg/cataloger/cpp/parse_conaninfo.go @@ -99,7 +99,7 @@ func parseConaninfo(_ context.Context, _ file.Resolver, _ *generic.Environment, for { line, err := r.ReadString('\n') switch { - case errors.Is(io.EOF, err): + case errors.Is(err, io.EOF): mainPackage := newConaninfoPackage( mainMetadata, reader.Location.WithAnnotation(pkg.EvidenceAnnotationKey, pkg.PrimaryEvidenceAnnotation), diff --git a/syft/pkg/cataloger/elixir/parse_mix_lock.go b/syft/pkg/cataloger/elixir/parse_mix_lock.go index 28ba38c3d63..dcd4a7858db 100644 --- a/syft/pkg/cataloger/elixir/parse_mix_lock.go +++ b/syft/pkg/cataloger/elixir/parse_mix_lock.go @@ -28,7 +28,7 @@ func parseMixLock(_ context.Context, _ file.Resolver, _ *generic.Environment, re for { line, err := r.ReadString('\n') switch { - case errors.Is(io.EOF, err): + case errors.Is(err, io.EOF): return packages, nil, nil case err != nil: return nil, nil, fmt.Errorf("failed to parse mix.lock file: %w", err) diff --git a/syft/pkg/cataloger/haskell/parse_cabal_freeze.go b/syft/pkg/cataloger/haskell/parse_cabal_freeze.go index 6bedc3e6917..614524cae26 100644 --- a/syft/pkg/cataloger/haskell/parse_cabal_freeze.go +++ b/syft/pkg/cataloger/haskell/parse_cabal_freeze.go @@ -23,7 +23,7 @@ func parseCabalFreeze(_ context.Context, _ file.Resolver, _ *generic.Environment for { line, err := r.ReadString('\n') switch { - case errors.Is(io.EOF, err): + case errors.Is(err, io.EOF): return pkgs, nil, nil case err != nil: return nil, nil, fmt.Errorf("failed to parse cabal.project.freeze file: %w", err)