Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[BASH] Install golang
# GoLang installer
# if [ "$EUID" -ne 0 ]
# then echo "*** root permissions required ***"
# exit
# fi
[ $1 ] && VERSION="$1" || VERSION="1.17.5"
cd /usr/src
sudo rm -rf "$FILE" /usr/local/go
sudo wget "$FILE"
sudo tar -C /usr/local -xzf "$FILE"
sudo chown $USER: -R /usr/local/go
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
echo "export GOPATH=~/.go" >> ~/.profile
source ~/.profile
echo "$(go version)"
echo "NOTE: now run \`source ~/.profile\` to apply new env vars"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment