With the release of Glide 0.10 comes a number of new features including better vendoring support, Gom configuration imports, better information when conflicts arise, and smarter version control system detection. In this post I’ll share some of the details.
For some time Glide has supported updating projects that were vendored, that is stored in your version control system alongside your project code. This happened via the
--update-vendored flag. But, this functionality was limited. For example, how could you strip the VCS metadata, such as the
.git directories, in the first place or in an ongoing manner for transitive dependencies? It did less than the bare minimum.
In Glide 0.10 it can do more via a couple more flags:
-s) to strip VCS metadata (e.g.,
.gitdirectories) from the
-v) to strip nested
Using Glide to update vendored dependencies can be as easy as running:
$ glide up -u -s
Some dependencies may have a
vendor directory of their own and you may want to remove it. If you are vendoring the
--strip-vendor option can be used to remove nested
Godeps/_workspace directories (with Godeps rewriting being undone).
This makes Glide much better at vendoring dependencies.
We didn’t stop there. Glide now uses this functionality to store the Glide dependencies in our version control. That means using
go get to install Glide will get you the pinned versions of the dependencies. Essentially, we’re sipping our own champaign with this feature.
Better Conflict Data
When multiple transitive dependencies request different versions of the same dependency Glide will notify you of the conflict. In 0.10 it will also tell you information about commits. For example,
[WARN] Conflict: github.com/aws/aws-sdk-go rev is currently bf2f8fe7f45e68017086d069498638893feddf64, but github.com/google/cadvisor wants 72440a9c5a884936f1c679591fcf04e31a9b772a [INFO] github.com/aws/aws-sdk-go reference bf2f8fe7f45e68017086d069498638893feddf64: [INFO] - author: Jason Del Ponte <XXXXXXXX@XXXXXXX> [INFO] - commit date: Mon, 21 Dec 2015 11:30:48 -0800 [INFO] - subject (first line): Tag release v1.0.7 [INFO] github.com/aws/aws-sdk-go reference 72440a9c5a884936f1c679591fcf04e31a9b772a: [INFO] - author: Jason Del Ponte <dXXXXXXXX@XXXXXXX> [INFO] - commit date: Tue, 16 Feb 2016 14:36:47 -0800 [INFO] - subject (first line): Tag release v1.1.3
Note, the emails were obfuscated for this post.
This can be used to help you make decisions. For example, in the top level
glide.yaml file you can include this import and set it to the version you want to use.
Smarter Version Control Detection
glide.yaml file a repository location can be specified for a dependency via the
repo property. When the
repo url doesn’t provide enough information to detect the VCS the
vcs property can be used to specify it. This enables forks and private repositories.
In 0.10 there is better detection for version control systems. For example, it can now detect:
email@example.com/foo/baras Git and
git+ssh://schemes as Git. It can also detect
bzr+ssh://as the appropriate types.
This means there are fewer occasions to specify the
If an imported dependency is managed by another package manager Glide tries to use the stored configuration as guidance. For some time Godep, GPM, and GB have been supported. In 0.10 Gom is supported as well.