mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
use internal mimetype helper in go binary cataloger
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
fc64a1a588
commit
4d5997981c
@ -16,15 +16,6 @@ import (
|
|||||||
|
|
||||||
const catalogerName = "go-module-binary-cataloger"
|
const catalogerName = "go-module-binary-cataloger"
|
||||||
|
|
||||||
// current mime types to search by to discover go binaries
|
|
||||||
var mimeTypes = []string{
|
|
||||||
"application/x-executable",
|
|
||||||
"application/x-mach-binary",
|
|
||||||
"application/x-elf",
|
|
||||||
"application/x-sharedlib",
|
|
||||||
"application/vnd.microsoft.portable-executable",
|
|
||||||
}
|
|
||||||
|
|
||||||
type Cataloger struct{}
|
type Cataloger struct{}
|
||||||
|
|
||||||
// NewGoModuleBinaryCataloger returns a new Golang cataloger object.
|
// NewGoModuleBinaryCataloger returns a new Golang cataloger object.
|
||||||
@ -41,7 +32,7 @@ func (c *Cataloger) Name() string {
|
|||||||
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
|
||||||
|
|
||||||
fileMatches, err := resolver.FilesByMIMEType(mimeTypes...)
|
fileMatches, err := resolver.FilesByMIMEType(internal.ExecutableMIMETypeSet.List()...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pkgs, nil, fmt.Errorf("failed to find bin by mime types: %w", err)
|
return pkgs, nil, fmt.Errorf("failed to find bin by mime types: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user