From efe047a342ec868500407dc9c4e0f97291058167 Mon Sep 17 00:00:00 2001 From: Jonas Xavier Date: Wed, 4 May 2022 16:54:39 -0700 Subject: [PATCH] golang cataloger - main module version as is Signed-off-by: Jonas Xavier --- syft/pkg/cataloger/golang/parse_go_bin.go | 2 -- syft/pkg/cataloger/golang/parse_go_bin_test.go | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/syft/pkg/cataloger/golang/parse_go_bin.go b/syft/pkg/cataloger/golang/parse_go_bin.go index a736b8f512c..3ec13dc2898 100644 --- a/syft/pkg/cataloger/golang/parse_go_bin.go +++ b/syft/pkg/cataloger/golang/parse_go_bin.go @@ -29,13 +29,11 @@ var ( func makeGoMainPackage(mod *debug.BuildInfo, arch string, location source.Location) pkg.Package { gbs := getBuildSettings(mod.Settings) main := newGoBinaryPackage(&mod.Main, mod.GoVersion, arch, location, gbs) - main.Version = "(devel)" if v, ok := gbs["vcs.revision"]; ok { main.Version = v } - main.SetID() return main } diff --git a/syft/pkg/cataloger/golang/parse_go_bin_test.go b/syft/pkg/cataloger/golang/parse_go_bin_test.go index 19888f79df4..9fddb20501c 100644 --- a/syft/pkg/cataloger/golang/parse_go_bin_test.go +++ b/syft/pkg/cataloger/golang/parse_go_bin_test.go @@ -213,7 +213,7 @@ func TestBuildGoPkgInfo(t *testing.T) { arch: archDetails, mod: &debug.BuildInfo{ GoVersion: goCompiledVersion, - Main: debug.Module{Path: "github.com/anchore/syft"}, + Main: debug.Module{Path: "github.com/anchore/syft", Version: "(devel)"}, Settings: []debug.BuildSetting{ {Key: "GOARCH", Value: archDetails}, {Key: "GOOS", Value: "darwin"}, @@ -227,7 +227,7 @@ func TestBuildGoPkgInfo(t *testing.T) { arch: archDetails, mod: &debug.BuildInfo{ GoVersion: goCompiledVersion, - Main: debug.Module{Path: "github.com/anchore/syft"}, + Main: debug.Module{Path: "github.com/anchore/syft", Version: "(devel)"}, Settings: []debug.BuildSetting{ {Key: "GOARCH", Value: archDetails}, {Key: "GOOS", Value: "darwin"}, @@ -297,7 +297,7 @@ func TestBuildGoPkgInfo(t *testing.T) { arch: archDetails, mod: &debug.BuildInfo{ GoVersion: goCompiledVersion, - Main: debug.Module{Path: "github.com/anchore/syft"}, + Main: debug.Module{Path: "github.com/anchore/syft", Version: "(devel)"}, Settings: []debug.BuildSetting{ {Key: "GOARCH", Value: archDetails}, {Key: "GOOS", Value: "darwin"},