Last active
July 20, 2016 07:04
-
-
Save achille-roussel/891a700df88ec3f5f539e73f2a859f9b to your computer and use it in GitHub Desktop.
Go: add github vendor submodules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run in the root directory of a go package to list all direct github dependencies | |
# and create git submodules for them in the vendor directory. | |
for package in $( | |
go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep github.com | cut -d/ -f1-3 | grep -v $(go list .) | uniq | |
) | |
do | |
git submodule add https://$package vendor/$package | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment