Go dependency management tool experiment (deprecated)
Перейти к файлу
Sam Boyer 479edf3968 Add support for vanity import paths
Fixes sdboyer/gps#45.
2016-06-26 00:15:53 -04:00
_testdata/src More package list tests, plus the logic itself 2016-06-20 22:51:52 -04:00
.gitignore Remove and ignore vendor dir 2016-04-01 11:34:25 -04:00
LICENSE Initial commit 2016-03-14 23:33:42 -04:00
README.md 90 commits come down to one little x 2016-06-22 00:06:46 -04:00
analysis.go Remove commented prints and dead code 2016-06-23 11:23:34 -04:00
analysis_test.go Remove tests param from listPackages() 2016-06-20 22:56:31 -04:00
appveyor.yml Use different temp dirs for windows friendliness 2016-04-28 00:48:33 -04:00
bridge.go Put HashInputs() onto the solver itself. 2016-06-22 19:57:29 -04:00
circle.yml Try switching to circleci 2016-04-01 12:28:15 -04:00
constraint_test.go s/NewConstraint/NewSemverConstraint/ 2016-05-25 21:29:58 -04:00
constraints.go s/NewConstraint/NewSemverConstraint/ 2016-05-25 21:29:58 -04:00
discovery.go Add support for vanity import paths 2016-06-26 00:15:53 -04:00
errors.go Add check that dep pkgs exist on selected project 2016-06-22 00:03:51 -04:00
flags.go s/NewConstraint/NewSemverConstraint/ 2016-05-25 21:29:58 -04:00
glide.lock Fix weird values in glide.lock 2016-06-07 00:07:57 -04:00
glide.yaml Stab at reconciling analysis with manifest 2016-06-06 23:59:38 -04:00
hash.go Put HashInputs() onto the solver itself. 2016-06-22 19:57:29 -04:00
hash_test.go Put HashInputs() onto the solver itself. 2016-06-22 19:57:29 -04:00
import_mode_go15.go Parameterize import mode by go version 2016-06-21 08:55:24 -04:00
import_mode_go16.go Parameterize import mode by go version 2016-06-21 08:55:24 -04:00
lock.go Types all realigned, woot! 2016-06-15 21:59:04 -04:00
manager_test.go Fix os.RemoveAll() for windows pre-go1.7 2016-06-22 10:56:17 -04:00
manifest.go Handle nil manifests coming from analyzer 2016-06-22 21:18:56 -04:00
project_manager.go Handle nil manifests coming from analyzer 2016-06-22 21:18:56 -04:00
remote.go Add support for vanity import paths 2016-06-26 00:15:53 -04:00
remote_test.go Add support for vanity import paths 2016-06-26 00:15:53 -04:00
remove_go16.go Fix os.RemoveAll() for windows pre-go1.7 2016-06-22 10:56:17 -04:00
remove_go17.go Fix os.RemoveAll() for windows pre-go1.7 2016-06-22 10:56:17 -04:00
result.go Fix os.RemoveAll() for windows pre-go1.7 2016-06-22 10:56:17 -04:00
result_test.go Types all realigned, woot! 2016-06-15 21:59:04 -04:00
satisfy.go Add check that dep pkgs exist on selected project 2016-06-22 00:03:51 -04:00
selection.go ExternalReach stuff was just super wrong 2016-06-17 11:00:57 -04:00
solve_basic_test.go Strip out old standalone analysis funcs 2016-06-21 00:58:18 -04:00
solve_bimodal_test.go Add check that dep pkgs exist on selected project 2016-06-22 00:03:51 -04:00
solve_test.go Put HashInputs() onto the solver itself. 2016-06-22 19:57:29 -04:00
solver.go Handle nil manifests coming from analyzer 2016-06-22 21:18:56 -04:00
source_manager.go Strip out old standalone analysis funcs 2016-06-21 00:58:18 -04:00
types.go Remove emptyProjectAtom for nilpa 2016-06-21 23:00:50 -04:00
version.go Unit tests for versionTypeUnion 2016-05-17 21:48:41 -04:00
version_queue.go Just make Solve() a plain function 2016-06-06 14:20:37 -04:00
version_test.go Numerous fixups and docs: 2016-04-16 20:33:07 -04:00

README.md

vsolver

vsolver is a specialized SAT solver, designed as an engine for Go package management. The initial plan is integration into glide, but vsolver could be used by any tool interested in fully solving the package management problem.

NOTE - vsolver isnt ready yet, but its getting close.

The implementation is derived from the solver used in Dart's pub package management tool.

Assumptions

Package management is far too complex to be assumption-less. vsolver tries to keep its assumptions to the minimum, supporting as many situations as is possible while still maintaining a predictable, well-formed system.

  • Go 1.6, or 1.5 with GO15VENDOREXPERIMENT = 1 set. vendor directories are a requirement.
  • You don't manually change what's under vendor/. Thats toolings job.
  • A project concept, where projects comprise the set of Go packages in a rooted tree on the filesystem. By happy (not) accident, that rooted tree is exactly the same set of packages covered by a vendor/ directory.
  • A manifest-and-lock approach to tracking project manifest data. The solver takes manifest (and, optionally, lock)-type data as inputs, and produces lock-type data as its output. Tools decide how to actually store this data, but these should generally be at the root of the project tree.

Manifests? Locks? Eeew. Yes, we also think it'd be swell if we didn't need metadata files. We love the idea of Go packages as standalone, self-describing code. Unfortunately, the wheels come off that idea as soon as versioning and cross-project/repository dependencies happen. Universe alignment is hard; trying to intermix version information directly with the code would only make matters worse.

Arguments

Some folks are against using a solver in Go. Even the concept is repellent. These are some of the arguments that are raised:

"It seems complicated, and idiomatic Go things are simple!"

Complaining about this is shooting the messenger.

Selecting acceptable versions out of a big dependency graph is a boolean satisfiability (or SAT) problem: given all possible combinations of valid dependencies, were trying to find a set that satisfies all the mutual requirements. Obviously that requires version numbers lining up, but it can also (and vsolver will/does) enforce invariants like “no import cycles” and type compatibility between packages. All of those requirements must be rechecked every time we discovery and add a new project to the graph.

SAT was one of the very first problems to be proven NP-complete. OF COURSE ITS COMPLICATED. We didnt make it that way. Truth is, though, solvers are an ideal way of tackling this kind of problem: it lets us walk the line between pretending like versions dont exist (a la go get) and pretending like only one version of a dep could ever work, ever (most of the current community tools).

"(Tool X) uses a solver and I don't like that tools UX!"

Sure, there are plenty of abstruse package managers relying on SAT solvers out there. But that doesnt mean they ALL have to be confusing. vsolvers algorithms are artisinally handcrafted with ❤️ for Gos use case, and we are committed to making Go dependency management a grokkable process.

Features

Yes, most people will probably find most of this list incomprehensible right now. We'll improve/add explanatory links as we go!

  • Passing bestiary of tests brought over from dart
  • Dependency constraints based on SemVer, branches, and revisions. AKA, "all the ways you might depend on Go code now, but coherently organized."
  • Define different network addresses for a given import path
  • Global project aliasing. This is a bit different than the previous.
  • Bi-modal analysis (project-level and package-level)
  • Specific sub-package dependencies
  • Enforcing an acyclic project graph (mirroring the Go compiler's enforcement of an acyclic package import graph)
  • On-the-fly static analysis (e.g. for incompatibility assessment, type escaping)
  • Optional package duplication as a conflict resolution mechanism
  • Faaaast, enabled by aggressive caching of project metadata
  • Lock information parameterized by build tags (including, but not limited to, GOOS/GOARCH)
  • Non-repository root and nested manifest/lock pairs

Note that these goals are not fixed - we may drop some as we continue working. Some are also probably out of scope for the solver itself, but still related to the solver's operation.