From 4c3bdf0d474a7e8cdfd4969c257caceefd6852b7 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Sat, 11 Nov 2017 11:27:59 -0600 Subject: [PATCH] Don't require a revision to import govendor config There are valid govendor configs in the wild that do not have a revision set, essentially requiring the package but not locking to a revision. We should allow that and not stop the import. --- internal/importers/govendor/importer.go | 7 ++----- internal/importers/govendor/importer_test.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/importers/govendor/importer.go b/internal/importers/govendor/importer.go index 92be7c34bc..44ae970c56 100644 --- a/internal/importers/govendor/importer.go +++ b/internal/importers/govendor/importer.go @@ -101,11 +101,8 @@ func (g *Importer) convert(pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock, error) return nil, nil, err } - // Revision must not be empty - if pkg.Revision == "" { - err := errors.New("invalid govendor configuration, Revision is required") - return nil, nil, err - } + // There are valid govendor configs in the wild that don't have a revision set + // so we are not requiring it to be set during import ip := base.ImportedPackage{ Name: pkg.Path, diff --git a/internal/importers/govendor/importer_test.go b/internal/importers/govendor/importer_test.go index ec5186fa52..93553d6a7b 100644 --- a/internal/importers/govendor/importer_test.go +++ b/internal/importers/govendor/importer_test.go @@ -124,7 +124,7 @@ func TestGovendorConfig_Convert(t *testing.T) { WantConvertErr: true, }, }, - "missing package revision": { + "missing package revision doesn't cause an error": { govendorFile{ Package: []*govendorPackage{ { @@ -133,7 +133,7 @@ func TestGovendorConfig_Convert(t *testing.T) { }, }, importertest.TestCase{ - WantConvertErr: true, + WantConstraint: "*", }, }, }