Last active
June 2, 2020 07:57
-
-
Save chrisvdg/0f25142700cdf6362496c075dc697b8d to your computer and use it in GitHub Desktop.
Golang installation scripts
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 | |
GOVersion="1.14.3" | |
echo "Removing go if already present" | |
rm -dr /usr/local/go | |
echo "Downloading Go" | |
wget -O go.tar.gz https://storage.googleapis.com/golang/go$GOVersion.linux-armv6l.tar.gz | |
echo "Extracting Go" | |
sudo tar -C /usr/local -xzf go.tar.gz | |
# cleanup | |
echo "Removing Go download file" | |
rm go.tar.gz | |
echo "Setting up Go evironment" | |
mkdir ~/go ~/go/src ~/go/bin ~/go/pkg | |
echo "Setting up Go environmental variables" | |
echo "" >> ~/.profile | |
echo "# golang" >> ~/.profile | |
echo "export GOPATH=~/go" >> ~/.profile | |
echo "export GOSRC=~/go/src" >> ~/.profile | |
echo "export PATH=/usr/local/go/bin:~/go/bin:\$PATH" >> ~/.profile | |
# source the new exports | |
source ~/.profile | |
# test if golang works | |
go version | |
echo 'Load the new profile settings by logging out and in again or execute "source ~/.profile"' |
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 | |
GOVersion="1.14.3" | |
echo "Removing go if already present" | |
rm -dr /usr/local/go | |
echo "Downloading Go" | |
wget -O go.tar.gz https://storage.googleapis.com/golang/go$GOVersion.linux-amd64.tar.gz | |
echo "Extracting Go" | |
tar -C /usr/local -xzf go.tar.gz | |
# cleanup | |
echo "Removing Go download file" | |
rm go.tar.gz | |
echo "Setting up Go evironment" | |
mkdir ~/go ~/go/src ~/go/bin ~/go/pkg | |
echo "Setting up Go environmental variables" | |
echo "" >> ~/.profile | |
echo "# golang" >> ~/.profile | |
echo "export GOPATH=~/go" >> ~/.profile | |
echo "export GOSRC=~/go/src" >> ~/.profile | |
echo "export PATH=/usr/local/go/bin:~/go/bin:\$PATH" >> ~/.profile | |
# source the new exports | |
source ~/.profile | |
# test if golang works | |
go version | |
echo 'Load the new profile settings by logging out and in again or execute "source ~/.profile"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment