Created
July 13, 2022 05:55
-
-
Save tebeka/a88052bd0fad07d42396d49c7fe6c1cd to your computer and use it in GitHub Desktop.
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/bash | |
case $1 in | |
-h | --help ) echo "usage: $(basename $0) [VERSION]"; exit;; | |
esac | |
if [ $# -gt 1 ]; then | |
1>&2 echo "error: wrong number of argument" | |
exit 1 | |
fi | |
cur=$(go version | awk '{print substr($3, 3)}') | |
if [ -z "$1" ]; then | |
# bump patch | |
version=$(echo ${cur} | awk -F. '{print $1 "." $2 "." $3+1}') | |
else | |
version=$1 | |
fi | |
echo "updating go to version ${version} (current: ${cur})" | |
go install golang.org/dl/go${version}@latest | |
go${version} download | |
echo "updating link" | |
ln -sfn ${HOME}/sdk/go${version} ${HOME}/sdk/go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment