From 47ba507e05dbb2336c9f000b3ace3ac4c6bde308 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sat, 8 Feb 2020 11:54:53 +0500 Subject: [PATCH] Put commit hash and branch name if dependency's version is empty when parsing dep project. --- parsers/golang/dep.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parsers/golang/dep.go b/parsers/golang/dep.go index b718d36..85a3f39 100644 --- a/parsers/golang/dep.go +++ b/parsers/golang/dep.go @@ -88,6 +88,11 @@ func (gp *golangParser) getDependenciesFromDep(pkgPath string) []*structs.Depend dependency.VCS.Branch = "master" } + // If version is empty - write branch name here with commit hash. + if dependency.Version == "" { + dependency.Version = dependency.VCS.Revision + "@" + dependency.VCS.Branch + } + // All dep-controlled dependencies are vendored. We should get // it's path. dependency.LocalPath = filepath.Join(pkgPath, "vendor", dep.Name)