mirror of
https://github.com/anchore/syft.git
synced 2026-07-05 02:28:25 +02:00
fix: lintfix
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
parent
7050c09094
commit
27f33d0e99
@ -76,7 +76,7 @@ func (c *goBinaryCataloger) recordStdlibSymbols(coord file.Coordinates, symbols
|
||||
}
|
||||
c.stdlibSymbolsMu.Lock()
|
||||
defer c.stdlibSymbolsMu.Unlock()
|
||||
merged := append(c.stdlibSymbols[coord], symbols...)
|
||||
merged := slices.Concat(c.stdlibSymbols[coord], symbols)
|
||||
slices.Sort(merged)
|
||||
c.stdlibSymbols[coord] = slices.Compact(merged)
|
||||
}
|
||||
|
||||
@ -13,6 +13,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// mainPackage is the import path the linker assigns to the binary's main package.
|
||||
const mainPackage = "main"
|
||||
|
||||
// binarySymbol represents a single function symbol extracted from a go binary's pclntab.
|
||||
type binarySymbol struct {
|
||||
// packagePath is the import path of the package that owns the symbol (e.g. "github.com/foo/bar/internal/baz")
|
||||
@ -224,7 +227,7 @@ func moduleSymbols(symbols []binarySymbol, main *debug.Module, deps []*debug.Mod
|
||||
results := make(map[string][]string)
|
||||
for _, sym := range symbols {
|
||||
pkgPath := sym.packagePath
|
||||
if pkgPath == "main" && main != nil {
|
||||
if pkgPath == mainPackage && main != nil {
|
||||
// the linker renames the main package's import path to "main"
|
||||
pkgPath = main.Path
|
||||
}
|
||||
@ -236,7 +239,7 @@ func moduleSymbols(symbols []binarySymbol, main *debug.Module, deps []*debug.Mod
|
||||
}
|
||||
}
|
||||
if best == "" {
|
||||
if pkgPath != "main" && isStandardImportPath(pkgPath) {
|
||||
if pkgPath != mainPackage && isStandardImportPath(pkgPath) {
|
||||
stdlib = append(stdlib, sym.name)
|
||||
}
|
||||
continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user