Skip to content

Instantly share code, notes, and snippets.

@forelabs
Created September 25, 2019 08:31
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 forelabs/daa24411ecada3a80480db22c7cf9530 to your computer and use it in GitHub Desktop.
Save forelabs/daa24411ecada3a80480db22c7cf9530 to your computer and use it in GitHub Desktop.
go version update
function update-go() {
release=$(curl --silent https://golang.org/doc/devel/release.html | grep -Eo 'go[0-9]+(\.[0-9]+)+' | sort -V | uniq | tail -1)
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(case "$(uname -m)" in i*) echo '386' ;; x*) echo 'amd64' ;; *) echo 'armv61'; esac)
curl --silent https://storage.googleapis.com/golang/$release.$os-$arch.tar.gz \
| sudo tar -vxz --strip-components 1 -C $(dirname $(dirname $(which go)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment