Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit b9f1941

Browse files
committed
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.
1 parent 0921762 commit b9f1941

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

internal/importers/govendor/importer.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,8 @@ func (g *Importer) convert(pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock, error)
101101
return nil, nil, err
102102
}
103103

104-
// Revision must not be empty
105-
if pkg.Revision == "" {
106-
err := errors.New("invalid govendor configuration, Revision is required")
107-
return nil, nil, err
108-
}
104+
// There are valid govendor configs in the wild that don't have a revision set
105+
// so we are not requiring it to be set during import
109106

110107
ip := base.ImportedPackage{
111108
Name: pkg.Path,

internal/importers/govendor/importer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestGovendorConfig_Convert(t *testing.T) {
124124
WantConvertErr: true,
125125
},
126126
},
127-
"missing package revision": {
127+
"missing package revision doesn't cause an error": {
128128
govendorFile{
129129
Package: []*govendorPackage{
130130
{
@@ -133,7 +133,7 @@ func TestGovendorConfig_Convert(t *testing.T) {
133133
},
134134
},
135135
importertest.TestCase{
136-
WantConvertErr: true,
136+
WantConstraint: "*",
137137
},
138138
},
139139
}

0 commit comments

Comments
 (0)