Skip to content

Instantly share code, notes, and snippets.

@minzak
Created October 18, 2020 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minzak/7867a4d392526da9b85ec5290a973c3e to your computer and use it in GitHub Desktop.
Save minzak/7867a4d392526da9b85ec5290a973c3e to your computer and use it in GitHub Desktop.
Fing latest go version and install it.
echo "Getting latest Go version."
goarch="$(wget -qO- https://golang.org/dl/ | grep -oP 'go([0-9\.]+)\.linux-amd64\.tar\.gz' | head -n 1 )"
echo "Downloading latest Go for AMD64: ${goarch}"
wget --quiet --continue --show-progress "https://golang.org/dl/${goarch}"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf $goarch
rm $goarch
unset goarch
go version
#if [ -d "/usr/local/go" ] ; then
# export GOROOT=/usr/local/go
# export GOPATH=/usr/src/go
# export PATH=$PATH:$GOROOT/bin
# export CGO_ENABLE=0
# #export $GOOS=linux
# #export $GOARCH=amd64
# else
#export PATH
#fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment