- Notifications
You must be signed in to change notification settings - Fork57
Minimalistic Go vendored code manager
License
rancher/trash
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Keeping the trash in your ./vendor dir to a minimum.
Make sure you're using go1.6 or later version.
- Download and extractlatest release to your PATH.Alternatively, install or update current development version with
go get -u github.com/rancher/trash
. - Copy
vendor.conf
file to your project and edit to your needs. - Run
trash
.
vendor.conf
(in your project root dir) specifies the revisions (git tags or commits, or branches - if you're drunk) of the libraries to be fetched, checked out and copied to ./vendor dir. For example:
github.com/rancher/trashgithub.com/Sirupsen/logrus v0.8.7 https://github.com/imikushin/logrus.gitgithub.com/codegangsta/cli b5232bbgithub.com/cloudfoundry-incubator/candiedyaml 5a459c2
Or, in YML format:
import:-package:github.com/Sirupsen/logrus# package nameversion:v0.8.7# tag or commitrepo:https://github.com/imikushin/logrus.git# (optional) git URL-package:github.com/codegangsta/cliversion:b5232bb2934f606f9f27a1305f1eea224e8e8b88-package:github.com/cloudfoundry-incubator/candiedyamlversion:55a459c2d9da2b078f0725e5fb324823b2c71702
Runtrash
to populate ./vendor directory and remove unnecessary files. Runtrash --keep
to keepall checked out files in ./vendor dir.
I really likedglide, it's like areal package manager: specify what you need, runglide up
and enjoy your updated libraries. But it didn't help with a couple problems I had:
- All necessary library code should be vendored and checked into project repo (as imposed by the project policy)
- Unnecessary code should be removed
for great justicefor smaller git checkouts and fasterdocker build
I'd been slightly reluctant to the idea of writing it, but apparently the world needed another package manager: "Come on, it's just going to be 300 (okay, it's ~600) lines of Go!" Thanks to@ibuildthecloud for the idea.
For the world's convenience,trash
can detect glide.yaml (and glide.yml, as well as trash.yaml) and use that instead of vendor.conf (and you can Force it to use any other file). Just in case, here's the program help:
$ trash -hNAME: trash - Vendor imported packages and throw away the trash!USAGE: trash [global options] command [command options] [arguments...]VERSION: v0.2.7AUTHOR(S): @imikushin, @ibuildthecloudCOMMANDS: help, h Shows a list of commands or help for one commandGLOBAL OPTIONS: --file value, -f value Vendored packages list (default: "vendor.conf") --directory value, -C value The directory in which to run, --file is relative to this (default: ".") --target value, -T value The directory to store results (default: "vendor") --keep, -k Keep all downloaded vendor code (preserving .git dirs) --update value, -u value specify a list of packages to be updated --insecure Pass -insecure to 'go get' --debug, -d Debug logging --cache value Cache directory (default: "/Users/ivan/.trash-cache") [$TRASH_CACHE] --include-vendor whether to include vendor when running trash -k --help, -h show help --version, -v print the version
About
Minimalistic Go vendored code manager