Created
November 22, 2022 10:42
-
-
Save abiiranathan/89012da352619c0ef59383336bc144fd to your computer and use it in GitHub Desktop.
go installation script
This file contains 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
#!/bin/bash | |
ARCH="amd64" | |
LATEST_VERSION="go1.19.3" | |
# "$(curl -sL https://golang.org/VERSION?m=text)" | |
ZIP_FILE="${LATEST_VERSION}.linux-${ARCH}.tar.gz" | |
if [ -f "$ZIP_FILE" ]; then | |
echo "go version $LATEST_VERSION already downloaded" | |
else | |
wget --no-check-certificate --continue --show-progress "https://golang.org/dl/$ZIP_FILE" | |
fi | |
if [ $? -eq 0 ]; then | |
echo "Uninstalling previous go version" | |
echo | |
sudo rm -rf /usr/local/go | |
sudo tar -C /usr/local -xzf "$ZIP_FILE" && rm -f "$ZIP_FILE" | |
else | |
echo "Installation aborted" >&2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment