-
-
Save sashadev-sky/dd2aac647200e11e55706d81dd2b842d to your computer and use it in GitHub Desktop.
go get binary@version
This file contains hidden or 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
#!/bin/sh | |
# This command installs binaries at specified versions | |
# into $GOBIN, $GOPATH/bin or $HOME/bin. | |
# It assumes Go 1.11. | |
if [ $# = 0 ]; then | |
usage: vgoget cmdpackage[@version]... >&2 | |
exit 2 | |
fi | |
d=`mktemp -d` | |
cd "$d" | |
echo 'module temp' > go.mod | |
for i; do | |
pkg=`echo $i | sed 's/@.*//'` | |
go get "$i" && | |
go install "$pkg" && | |
echo installed `go list -f '{{.ImportPath}}@{{.Module.Version}}' "$pkg"` | |
done | |
rm -r "$d" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment