Last active
July 10, 2024 01:11
-
-
Save codenoid/4806365032bb4ed62f381d8a76ddb8e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# codenoid | |
# https://gist.github.com/codenoid/4806365032bb4ed62f381d8a76ddb8e6 | |
printf "Checking latest Go version...\n"; | |
LATEST_GO_VERSION="$(curl --silent https://go.dev/VERSION?m=text | head -n 1)"; | |
LATEST_GO_DOWNLOAD_URL="https://go.dev/dl/${LATEST_GO_VERSION}.linux-amd64.tar.gz" | |
printf "cd to home ($USER) directory \n" | |
cd $HOME | |
printf "Downloading ${LATEST_GO_DOWNLOAD_URL}\n\n"; | |
curl -OJ -L --progress-bar $LATEST_GO_DOWNLOAD_URL | |
printf "Extracting file...\n" | |
tar -xf ${LATEST_GO_VERSION}.linux-amd64.tar.gz | |
export GOROOT="$HOME/go" | |
export GOPATH="$HOME/go/packages" | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | |
printf '⚠️ ADD (OR REPLACE) THIS LINE BELOW TO YOUR ~/.bashrc ⚠️ | |
export GOROOT="$HOME/go" | |
export GOPATH="$HOME/go/packages" | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | |
\n' | |
printf "You are ready to Go!"; | |
go version |
Sorry guys, I just update the main repository
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Multiple Problems:
link moved:
https://golang.org
tohttps://go.dev
https://go.dev/VERSION?m=text
gives out a timestamp after the version, which causes the script to break.try to use something like
curl --silent https://go.dev/VERSION?m=text | head -n 1