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

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

Description

@sdboyer

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions