fix: lintfix

Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
Christopher Phillips 2026-06-30 23:15:53 -04:00
parent 7050c09094
commit 27f33d0e99
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View File

@ -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)
}

View File

@ -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