Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syft bootstrap tools to latest versions. #1682

Merged
merged 2 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ CHRONICLE_CMD = $(TEMP_DIR)/chronicle
GLOW_CMD = $(TEMP_DIR)/glow

# Tool versions #################################
GOLANGCILINT_VERSION := v1.51.2
GOLANGCILINT_VERSION := v1.52.0
GOSIMPORTS_VERSION := v0.3.8
BOUNCER_VERSION := v0.4.0
CHRONICLE_VERSION := v0.6.0
GORELEASER_VERSION := v1.16.1
GORELEASER_VERSION := v1.16.2
YAJSV_VERSION := v1.4.1
COSIGN_VERSION := v1.13.1
QUILL_VERSION := v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/syft/cli/attest/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/anchore/syft/syft/source"
)

func Run(ctx context.Context, app *config.Application, args []string) error {
func Run(_ context.Context, app *config.Application, args []string) error {
err := ValidateOutputOptions(app)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func (o AttestOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindAttestConfigOptions(cmd.Flags(), v)
}

//nolint:revive
func bindAttestConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
if err := v.BindPFlag("attest.key", flags.Lookup("key")); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/fulcio.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (o *FulcioOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindFulcioConfigOptions(cmd.Flags(), v)
}

//nolint:revive
func bindFulcioConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
if err := v.BindPFlag("attest.fulcio-url", flags.Lookup("fulcio-url")); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (o *OIDCOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindOIDCConfigOptions(cmd.Flags(), v)
}

//nolint:revive
func bindOIDCConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
if err := v.BindPFlag("attest.oidc-issuer", flags.Lookup("oidc-issuer")); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (o *PackagesOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindPackageConfigOptions(cmd.Flags(), v)
}

//nolint:revive
func bindPackageConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
// Formatting & Input options //////////////////////////////////////////////

Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/rekor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func (o *RekorOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindRekorConfigOptions(cmd.Flags(), v)
}

//nolint:revive
func bindRekorConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
// TODO: config re-design
if err := v.BindPFlag("attest.rekor-url", flags.Lookup("rekor-url")); err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/syft/cli/options/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func (o *RootOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
return bindRootConfigOptions(cmd.PersistentFlags(), v)
}

//nolint:revive
func bindRootConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error {
if err := v.BindPFlag("config", flags.Lookup("config")); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/syft/cli/options/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type VersionOptions struct {

var _ Interface = (*VersionOptions)(nil)

func (o *VersionOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error {
func (o *VersionOptions) AddFlags(cmd *cobra.Command, _ *viper.Viper) error {
cmd.Flags().StringVarP(&o.Output, "output", "o", "text", "format to show version information (available=[text, json])")
return nil
}
2 changes: 1 addition & 1 deletion cmd/syft/cli/packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/anchore/syft/syft/source"
)

func Run(ctx context.Context, app *config.Application, args []string) error {
func Run(_ context.Context, app *config.Application, args []string) error {
err := ValidateOutputOptions(app)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/syft/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/anchore/syft/internal/version"
)

func Version(v *viper.Viper, app *config.Application) *cobra.Command {
func Version(v *viper.Viper, _ *config.Application) *cobra.Command {
o := &options.VersionOptions{}
cmd := &cobra.Command{
Use: "version",
Expand Down
5 changes: 1 addition & 4 deletions internal/file/zip_file_traversal.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ func UnzipToDir(archivePath, targetDir string) error {
return err
}

if err = extractSingleFile(file, joinedPath, archivePath); err != nil {
return err
}
return nil
return extractSingleFile(file, joinedPath, archivePath)
}

return TraverseFilesInZip(archivePath, visitor)
Expand Down
3 changes: 1 addition & 2 deletions syft/cpe/cpe.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ func stripSlashes(s string) string {
for i, c := range s {
if c == '\\' && i+1 < len(s) && strings.ContainsRune(allowedCPEPunctuation, rune(s[i+1])) {
continue
} else {
sb.WriteRune(c)
}
sb.WriteRune(c)
}
return sb.String()
}
Expand Down
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func runCataloger(cataloger pkg.Cataloger, resolver source.FileResolver) (catalo
// request.
//
//nolint:funlen
func Catalog(resolver source.FileResolver, release *linux.Release, parallelism int, catalogers ...pkg.Cataloger) (*pkg.Catalog, []artifact.Relationship, error) {
func Catalog(resolver source.FileResolver, _ *linux.Release, parallelism int, catalogers ...pkg.Cataloger) (*pkg.Catalog, []artifact.Relationship, error) {
catalog := pkg.NewCatalog()
var allRelationships []artifact.Relationship

Expand Down
5 changes: 3 additions & 2 deletions syft/pkg/cataloger/erlang/erlang_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ func printError(data []byte, i int) string {
if c == '\n' {
prev = append(prev, curr.String())
curr.Reset()

if idx >= i {
break
} else {
line++
}

line++
char = 1
continue
}
Expand Down
3 changes: 1 addition & 2 deletions syft/pkg/cataloger/javascript/parse_package_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ func parsePackageLock(resolver source.FileResolver, _ *generic.Environment, read
if name == "" {
if pkgMeta.Name == "" {
continue
} else {
name = pkgMeta.Name
}
name = pkgMeta.Name
}

// handles alias names
Expand Down
2 changes: 1 addition & 1 deletion syft/source/mock_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (r MockResolver) FilesByBasename(filenames ...string) ([]Location, error) {
return results, nil
}

func (r MockResolver) FilesByBasenameGlob(globs ...string) ([]Location, error) {
func (r MockResolver) FilesByBasenameGlob(_ ...string) ([]Location, error) {
// TODO implement me
panic("implement me")
}