This is a simple bash script for managing Go vendor libraries. Use this script to vendor your libraries if you don't want the libraries as git submodules. That way, you can actually commit the source of the libraries into your repo. The script does this by renmaing the .git
folder to .checkout_git
.
git clone
this repo or copy and paste the vendor.sh
script into your vendor/
directory.
Instead of using go get
, you run the script instead.
cd path/to/my/repo
./vendor/vendor.sh {package}
./vendor/vendor.sh golang.org/x/tools/cmd/goimports
This is the resulting file structure in vendor/
path/to/my/repo
--- vendor/
------ vendor.sh
------ golang.org/x/tools/cmd/goimports
- Change the GOPATH temporarily to the
vendor/
directory - Rename the
.checkout_git
directories to.git
- Go get the package
- Rename the
.git
directories back to.checkout_git
- Move the files out of vendor/src/ into the vendor/ directory