mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
read Go main module version as is - (devel) (#981)
* read Go main module version as is - (devel) Signed-off-by: Jonas Galvão Xavier <jonasx@anchore.com> * fix package test with default (devel) main module Signed-off-by: Jonas Galvão Xavier <jonasx@anchore.com>
This commit is contained in:
parent
37927b8b23
commit
ab289933da
@ -29,12 +29,13 @@ var (
|
|||||||
func makeGoMainPackage(mod *debug.BuildInfo, arch string, location source.Location) pkg.Package {
|
func makeGoMainPackage(mod *debug.BuildInfo, arch string, location source.Location) pkg.Package {
|
||||||
gbs := getBuildSettings(mod.Settings)
|
gbs := getBuildSettings(mod.Settings)
|
||||||
main := newGoBinaryPackage(&mod.Main, mod.GoVersion, arch, location, gbs)
|
main := newGoBinaryPackage(&mod.Main, mod.GoVersion, arch, location, gbs)
|
||||||
main.Version = ""
|
main.Version = "(devel)"
|
||||||
|
|
||||||
if v, ok := gbs["vcs.revision"]; ok {
|
if v, ok := gbs["vcs.revision"]; ok {
|
||||||
main.Version = v
|
main.Version = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main.SetID()
|
||||||
return main
|
return main
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -133,6 +133,7 @@ func TestBuildGoPkgInfo(t *testing.T) {
|
|||||||
FoundBy: catalogerName,
|
FoundBy: catalogerName,
|
||||||
Language: pkg.Go,
|
Language: pkg.Go,
|
||||||
Type: pkg.GoModulePkg,
|
Type: pkg.GoModulePkg,
|
||||||
|
Version: "(devel)",
|
||||||
Locations: source.NewLocationSet(
|
Locations: source.NewLocationSet(
|
||||||
source.Location{
|
source.Location{
|
||||||
Coordinates: source.Coordinates{
|
Coordinates: source.Coordinates{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user