Dep: Warn when an importer cannot preserve a constraint

Created on 26 Jul 2017  路  4Comments  路  Source: golang/dep

This is additional work for the long-term solution to #748.

When an importer tries to constrain a dependency, but for some reason the constraint isn't valid, e.g. the branch was deleted, the tag removed, currently the importer stops with an error. The user must then edit the imported config file to remove the offending data that is triggering dep to import a constraint.

Instead of immediately stopping, the importers should print a warning that it can't preserve the existing constraint. It should still lock to a revision, and infer a sane constraint based on that revision.

help wanted init

Most helpful comment

I might have some time to work on this, this coming week if there are no huge gotcha's. I assume the problem is either in init.go or all three importers?

All 4 comments

I might have some time to work on this, this coming week if there are no huge gotcha's. I assume the problem is either in init.go or all three importers?

@djosephsen Yay! That would be very helpful if you have time. Here's some more context:

Each importer calls sm.InferConstraint to convert from a parsed string in an external config file (e.g. glide.yaml) to a dep constraint. Right now when an error is returned from that function, the importer gives up. Instead each importer should handle the error by printing a warning, skipping the constraint, and moving on to the next step.

Looking at it now.. So in the case of a _singular_ un-parsable constraint in an external config file (in other words.. skipping it means we have an empty manifest/lock), how should the importer behave? Exit with an error because no constraints could be enforced?

code better than words about code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikkeloscar picture mikkeloscar  路  45Comments

sdboyer picture sdboyer  路  40Comments

godcong picture godcong  路  27Comments

davecheney picture davecheney  路  32Comments

sdboyer picture sdboyer  路  36Comments