diff --git a/syft/pkg/cataloger/golang/config.go b/syft/pkg/cataloger/golang/config.go index 604471954..36dca0fbc 100644 --- a/syft/pkg/cataloger/golang/config.go +++ b/syft/pkg/cataloger/golang/config.go @@ -91,7 +91,7 @@ func defaultGoModDir() string { func DefaultMainModuleVersionConfig() MainModuleVersionConfig { return MainModuleVersionConfig{ FromLDFlags: true, - FromContents: true, + FromContents: false, FromBuildSettings: true, } } diff --git a/syft/pkg/cataloger/golang/parse_go_binary_test.go b/syft/pkg/cataloger/golang/parse_go_binary_test.go index 36158507a..d1949d352 100644 --- a/syft/pkg/cataloger/golang/parse_go_binary_test.go +++ b/syft/pkg/cataloger/golang/parse_go_binary_test.go @@ -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,