fix linting

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2021-11-08 16:50:35 -05:00
parent 69d2b1ba3c
commit 253faf5652
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
2 changed files with 5 additions and 9 deletions

View File

@ -40,7 +40,6 @@ func (c *Cataloger) Name() string {
// Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing rpm db installation. // Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing rpm db installation.
func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error) { func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error) {
var pkgs []pkg.Package var pkgs []pkg.Package
var relationships []artifact.Relationship
fileMatches, err := resolver.FilesByMIMEType(mimeTypes...) fileMatches, err := resolver.FilesByMIMEType(mimeTypes...)
if err != nil { if err != nil {
@ -53,15 +52,14 @@ func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []arti
return pkgs, nil, fmt.Errorf("failed to resolve file contents by location: %w", err) return pkgs, nil, fmt.Errorf("failed to resolve file contents by location: %w", err)
} }
goPkgs, goRelationships, err := parseGoBin(location, r) goPkgs, err := parseGoBin(location, r)
if err != nil { if err != nil {
log.Warnf("could not parse possible go binary: %+v", err) log.Warnf("could not parse possible go binary: %+v", err)
} }
internal.CloseAndLogError(r, location.RealPath) internal.CloseAndLogError(r, location.RealPath)
pkgs = append(pkgs, goPkgs...) pkgs = append(pkgs, goPkgs...)
relationships = append(relationships, goRelationships...)
} }
return pkgs, relationships, nil return pkgs, nil, nil
} }

View File

@ -5,7 +5,6 @@ import (
"io" "io"
"strings" "strings"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )
@ -15,17 +14,16 @@ const (
replaceIdentifier = "=>" replaceIdentifier = "=>"
) )
func parseGoBin(location source.Location, reader io.ReadCloser) ([]pkg.Package, []artifact.Relationship, error) { func parseGoBin(location source.Location, reader io.ReadCloser) ([]pkg.Package, error) {
// Identify if bin was compiled by go // Identify if bin was compiled by go
x, err := openExe(reader) x, err := openExe(reader)
if err != nil { if err != nil {
return nil, nil, err return nil, err
} }
goVersion, mod := findVers(x) goVersion, mod := findVers(x)
return buildGoPkgInfo(location, mod, goVersion), nil, nil return buildGoPkgInfo(location, mod, goVersion), nil
} }
func buildGoPkgInfo(location source.Location, mod, goVersion string) []pkg.Package { func buildGoPkgInfo(location source.Location, mod, goVersion string) []pkg.Package {