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.
func (c *Cataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error) {
var pkgs []pkg.Package
var relationships []artifact.Relationship
fileMatches, err := resolver.FilesByMIMEType(mimeTypes...)
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)
}
goPkgs, goRelationships, err := parseGoBin(location, r)
goPkgs, err := parseGoBin(location, r)
if err != nil {
log.Warnf("could not parse possible go binary: %+v", err)
}
internal.CloseAndLogError(r, location.RealPath)
pkgs = append(pkgs, goPkgs...)
relationships = append(relationships, goRelationships...)
}
return pkgs, relationships, nil
return pkgs, nil, nil
}

View File

@ -5,7 +5,6 @@ import (
"io"
"strings"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source"
)
@ -15,17 +14,16 @@ const (
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
x, err := openExe(reader)
if err != nil {
return nil, nil, err
return nil, err
}
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 {