-
-
Save neonxp/b67684eac7a68455f098bb593ad01265 to your computer and use it in GitHub Desktop.
Simple version manager for golang
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
#!/bin/sh | |
if [ ! -f $HOME/go/bin/go$1 ]; then | |
echo "Version $1 not found, trying to install" | |
go install golang.org/dl/go$1\@latest | |
go$1 download | |
fi | |
rm $HOME/go/bin/go || true | |
echo "Linking go to version $1" | |
ln -s $HOME/go/bin/go$1 $HOME/go/bin/go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Just run gv with version tag:
~ gv 1.17.5
Script will check if specified version not installed - gv will download it.
Next creates symlink to new version.
Thats all!