Skip to content

Instantly share code, notes, and snippets.

@LucJosin
Forked from mnlwldr/goup.sh
Created March 15, 2024 00:05
Show Gist options
  • Save LucJosin/50725a300be380ed7d5bf8ebcf329f8d to your computer and use it in GitHub Desktop.
Save LucJosin/50725a300be380ed7d5bf8ebcf329f8d 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