Skip to content

Instantly share code, notes, and snippets.

@mnlwldr
Created March 14, 2024 15:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mnlwldr/788949ccffc99e5c91fd65e4132014a0 to your computer and use it in GitHub Desktop.
Save mnlwldr/788949ccffc99e5c91fd65e4132014a0 to your computer and use it in GitHub Desktop.
Update go to the latest version
#!/bin/sh
RELEASE=$(/usr/local/bin/go list -m -f '{{.Version}}' go@latest)
GO_FILE=go${RELEASE}.linux-amd64.tar.gz
BIN=https://go.dev/dl/${GO_FILE}
echo "download $GO_FILE from $BIN ..."
curl $BIN -L --output ${GO_FILE}
rm -rf /usr/local/go && tar -C /usr/local -xzf ${GO_FILE}
rm $GO_FILE
export PATH=$PATH:/usr/local/go/bin
go version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment