do not search binary contents for version for go package (#3874)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2025-05-09 13:49:17 -04:00 committed by GitHub
parent abe5e27b4b
commit f9d0fa81ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -91,7 +91,7 @@ func defaultGoModDir() string {
func DefaultMainModuleVersionConfig() MainModuleVersionConfig {
return MainModuleVersionConfig{
FromLDFlags: true,
FromContents: true,
FromContents: false,
FromBuildSettings: true,
}
}

View File

@ -855,6 +855,14 @@ func TestBuildGoPkgInfo(t *testing.T) {
},
{
name: "parse main mod and replace devel with pattern from binary contents",
cfg: func() *CatalogerConfig {
c := DefaultCatalogerConfig()
// off by default
assert.False(t, c.MainModuleVersion.FromContents)
// override to true for this test
c.MainModuleVersion.FromContents = true
return &c
}(),
mod: &extendedBuildInfo{
BuildInfo: &debug.BuildInfo{
GoVersion: goCompiledVersion,