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

Warn when an importer cannot preserve a constraint #907

Closed
carolynvs opened this issue Jul 26, 2017 · 4 comments
Closed

Warn when an importer cannot preserve a constraint #907

carolynvs opened this issue Jul 26, 2017 · 4 comments

Comments

@carolynvs
Copy link
Collaborator

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.

@djosephsen
Copy link
Contributor

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?

@carolynvs
Copy link
Collaborator Author

@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.

@djosephsen
Copy link
Contributor

djosephsen commented Aug 14, 2017

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?

@djosephsen
Copy link
Contributor

code better than words about code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants