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

Fixes #907 Warn when an importer cannot preserve a constraint #1086

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/dep/glide_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ func (g *glideImporter) buildProjectConstraint(pkg glidePackage) (pc gps.Project
}
pc.Constraint, err = g.sm.InferConstraint(pkg.Reference, pc.Ident)
if err != nil {
return
g.logger.Printf("Unable to interpret revision specifier '%s' for package %s: %s", pkg.Name, pc.Ident, err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these have trailing newlines \n?

I also wonder if it would be helpful to explicitly mention that Any is being used instead, or if that is the implied default or sufficiently documented elsewhere.

Copy link
Collaborator

@carolynvs carolynvs Aug 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the default for the importers is to use the any constraint whenever they can't determine something more specific. This ensures that imported dependencies (direct only) are always included in the generated manifest.

This behavior is not documented because we don't currently doc how the importers work. I am knee deep in redoing the importer plumbing, and when I submit that PR, will add doc for the general heuristic used by all importers.

pc.Constraint = gps.Any()
}

if g.verbose {
Expand Down
3 changes: 2 additions & 1 deletion cmd/dep/godep_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ func (g *godepImporter) buildProjectConstraint(pkg godepPackage) (pc gps.Project
pc.Ident = gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.ImportPath)}
pc.Constraint, err = g.sm.InferConstraint(pkg.Comment, pc.Ident)
if err != nil {
return
g.logger.Printf("Unable to interpret revision specifier '%s' for package %s: %s", pkg.ImportPath, pc.Ident, err.Error())
pc.Constraint = gps.Any()
}

f := fb.NewConstraintFeedback(pc, fb.DepTypeImported)
Expand Down