-
-
Save huglester/09b01d47ee7bfd01667cc4391c3a4bce to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
GO_VERSION=${GO_VERSION:=1.15.2} | |
cd /tmp/ \ | |
&& wget -q https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz \ | |
&& rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go*.tar.gz \ | |
&& rm go$GO_VERSION*.gz | |
echo "Creating default Go folders" | |
mkdir -p $HOME/go/bin | |
if [[ -z "${GOROOT}" ]]; then | |
echo "GOROOT is undefined --> creating defaut env variables" | |
echo -e '\nexport PATH=$HOME/go/bin:$PATH | |
export GOROOT=/usr/local/go | |
export GOPATH=$HOME/go | |
export GO111MODULE=auto | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> $HOME/.profile; | |
source $HOME/.profile | |
else | |
echo "GOROOT env is alredy exists: $GOROOT" | |
fi | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment