From 2a0fbc25c53088c4874f96d23b0489b949fc488a Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 14 Apr 2022 13:44:06 +0000 Subject: [PATCH] golang fix --- install/200-golang.sh | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/install/200-golang.sh b/install/200-golang.sh index fd566e9..7f68d26 100755 --- a/install/200-golang.sh +++ b/install/200-golang.sh @@ -1,28 +1,26 @@ #!/bin/bash -echo -echo "===============================================" -echo "Installing golang..." -echo "===============================================" -echo # https://go.dev/dl/ # https://golang.org/doc/install # https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu -[ $1 ] && VERSION="$1" || VERSION="1.17.6" + +[ $1 ] && VERSION="$1" || VERSION="1.18.1" FILE="go$VERSION.linux-amd64.tar.gz" -sudo rm -rf /usr/local/go -wget "https://golang.org/dl/$FILE" -O /tmp/$FILE -sudo tar -xzf $FILE -C /usr/local -rm -rf /tmp/$FILE -sudo chown $USER: -R /usr/local/go - -echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile -echo "export GOPATH=~/.go" >> $HOME/.profile -# source ~/.profile - echo -go version -echo "NOTE: now run 'source ~/.profile' to apply new env vars" -echo \ No newline at end of file +echo "===============================================" +echo "Installing golang v$VERSION..." +echo "===============================================" +echo + +sudo rm -rf /usr/local/go && \ + wget "https://golang.org/dl/$FILE" -O /tmp/$FILE && \ + sudo tar -xzf /tmp/$FILE -C /usr/local && \ + rm -rf /tmp/$FILE && \ + sudo chown $USER: -R /usr/local/go && \ + echo "export PATH=\"\$PATH:/usr/local/go/bin\"" >> $HOME/.profile && \ + echo "export GOPATH=\"~/.go\"" >> $HOME/.profile && \ + # source ~/.profile && \ + go version && \ + echo "NOTE: now run 'source ~/.profile' to apply new env vars"