Skip to content

Instantly share code, notes, and snippets.

@codenoid
Last active July 10, 2024 01:11
Show Gist options
  • Save codenoid/4806365032bb4ed62f381d8a76ddb8e6 to your computer and use it in GitHub Desktop.
Save codenoid/4806365032bb4ed62f381d8a76ddb8e6 to your computer and use it in GitHub Desktop.
# 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
@codenoid
Copy link
Author

Sorry guys, I just update the main repository

https://github.com/codenoid/install-latest-go-linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment