Created
April 23, 2023 15:44
-
-
Save miyataka/b3360d9a16c8421c90468720d885d4d2 to your computer and use it in GitHub Desktop.
install go latest version 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 | |
VERSION="1.20.3" | |
CPU="amd64" | |
arch=$(uname -i) | |
if [[ $arch == x86_64* ]]; then | |
echo "X64 Architecture" | |
CPU="amd64" | |
elif [[ $arch == i*86 ]]; then | |
echo "X32 Architecture" | |
CPU="386" | |
elif [[ $arch == arm* ]]; then | |
echo "ARM Architecture" | |
CPU="armv6l" | |
elif [[ $arch = aarch64 ]]; then | |
echo "ARM Architecture" | |
CPU="arm64" | |
fi | |
INSTALL_TARGET=go${VERSION}.linux-${CPU}.tar.gz | |
curl -LO --output-dir /usr/local/src/ https://go.dev/dl/${INSTALL_TARGET} | |
tar -C /usr/local -xzf /usr/local/src/${INSTALL_TARGET} | |
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile | |
source /etc/profile | |
go version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment