Skip to content

Instantly share code, notes, and snippets.

@abiiranathan
Created November 22, 2022 10:42
Show Gist options
  • Save abiiranathan/89012da352619c0ef59383336bc144fd to your computer and use it in GitHub Desktop.
Save abiiranathan/89012da352619c0ef59383336bc144fd to your computer and use it in GitHub Desktop.
go installation script
#!/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