-
Notifications
You must be signed in to change notification settings - Fork 1k
Add support importing from govend #1040
Add support importing from govend #1040
Conversation
@carolynvs Can you please take a look, when you have a minute? Thank you. |
Sorry, I forgot to mention this: |
analyzer-version = 1 | ||
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe" | ||
solver-name = "gps-cdcl" | ||
solver-version = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline at the end of the file should fix the failing tests ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I am Sorry. Thanks @bpicode .
It solved the failing tests :)
cmd/dep/govend_importer.go
Outdated
func (g *govendImporter) convert(pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock, error) { | ||
g.logger.Println("Converting from vendor.yaml...") | ||
|
||
manifest := &dep.Manifest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1019 just got merged. Let's use the new Manifest constructor here.
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptestdos" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No newline at EOF. Let's avoid this and add a newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a newline char at the EOF. But looks like github is not detecting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works :)
cmd/dep/govend_importer_test.go
Outdated
// Disable verbose so that we don't print values that change each test run | ||
g := newGovendImporter(logger, false, sm) | ||
if !g.HasDepMetadata(projectRoot) { | ||
t.Fatal("Expected the importer to detect godep configuration file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
godep govend
b6b6ae7
to
4603971
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few very small changes, and I think this is good!
FYI, we have recently merged a PR (#992) which switches the importer tests over to use a set of common validations. However I really don't want to hold up this PR, and we can tackle that in a separate PR once this is in.
EDIT: Oops, ignore this comment. 😊 It's the vndr importer, not this one, that needs to switch to using the new validations. I'll take care of that right now.
cmd/dep/govend_importer.go
Outdated
g.logger.Println("Detected govend configuration files...") | ||
y := filepath.Join(projectDir, govendYAMLName) | ||
if g.verbose { | ||
g.logger.Printf(" Loading %s", y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This should be two spaces, not a tab.
cmd/dep/govend_importer.go
Outdated
for _, pkg := range g.yaml.Imports { | ||
// Path must not be empty | ||
if pkg.Path == "" || pkg.Revision == "" { | ||
return nil, nil, errors.New("Invalid govend configuration, Path or Rev is required") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think it will help people if we use the exact same words used in the config file, so "path and rev are required".
pp := getProjectPropertiesFromVersion(version) | ||
if pp.Constraint != nil { | ||
pc, err := g.buildProjectConstraint(pkg, pp.Constraint.String()) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this isn't in the other importers yet, but we'd like to have import keep going even when we can't guess a constraint from the revision. See #907.
So when buildProjectConstraint
returns an error, let's log a warning like "Unable to infer a constraint for REVISION", and then skip adding the constraint to the manifest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carolynvs Done. Please take a look.
4603971
to
b28420b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Thank you for adding support for govend! 💖
What does this do / why do we need it?
This PR includes the support importing from govend.
What should your reviewer look out for in this PR?
dep int
now looks for vendor.yml file and converts it to Gopkg.toml and Gopkg.lock.Do you need help or clarification on anything?
I see the
go test
is failing for when I run it in cmd/dep.However, when I run, go test on the govend/case1 is it passing:
Which issue(s) does this PR fix?
Fixes #998