Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Allow args to inject required packages (graph "sources") #42

Closed
sdboyer opened this issue Jun 23, 2016 · 2 comments
Closed

Allow args to inject required packages (graph "sources") #42

sdboyer opened this issue Jun 23, 2016 · 2 comments

Comments

@sdboyer
Copy link
Owner

sdboyer commented Jun 23, 2016

When adding a new dependency, it's useful to be able to trick the static analyzer by adding a couple of packages as 'sources', even if only just temporarily. This lets a project get reconciled into the graph, included in the lock and downloaded into vendor at the time when the user issues a command like glide get. This allows the user to start importing and working from that package immediately, rather than needing to re-run another command after having actually introduced import statements for the named package.

To be concrete - without this kind of control, the workflow is awkward:

  1. User runs <tool> get github.com/foo/bar
  2. tool adds appropriate constraint to manifest
  3. vsolver quietly ignores the constraint on the first run because the project (presumably) doesn't actually import github.com/foo/bar yet
  4. User makes some changes in their editor, tries to add something that imports github.com/foo/bar
    • Maybe their autocomplete fails
    • Or worse, maybe their autocomplete, or goimports, picks up a copy of that dep from $GOPATH, which may not be the version they actually specified
  5. Either way, user "wtfs" at some point, until they re-run a solve with that import path in the source code

With this control, it's much better:

  1. User runs <tool> get github.com/foo/bar
  2. tool adds appropriate constraint to manifest
  3. tool injects github.com/foo/bar via this new param as a required package
  4. vsolver runs the solve and includes that package+project
    • or maybe fails b/c the package doesn't exist, but that's also good to know
  5. User goes on their merry way

The only issue here is that, if another solve is run BEFORE adding an import, there's no reasonable way for a tool to know to add those forced arguments again - not without keeping some icky, icky state somewhere. Perhaps that, though, is a reasonable cost.

@sdboyer sdboyer added this to the MVP milestone Jun 23, 2016
@sdboyer sdboyer removed this from the MVP milestone Jun 30, 2016
@sdboyer
Copy link
Owner Author

sdboyer commented Jun 30, 2016

Removing from MVP - seems like we can probably get away with just ignores for now.

@sdboyer
Copy link
Owner Author

sdboyer commented Dec 13, 2016

#114 is in, this is done

@sdboyer sdboyer closed this as completed Dec 13, 2016
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

1 participant