my-env/install/golang.sh

28 lines
877 B
Bash
Raw Normal View History

#!/bin/bash
##makedesc: Install golang v1.18.3
2022-01-09 08:52:56 +00:00
# https://go.dev/dl/
# https://golang.org/doc/install
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
2022-07-04 07:23:57 +00:00
[ $1 ] && VERSION="$1" || VERSION="1.18.3"
2022-04-14 13:44:06 +00:00
FILE="go$VERSION.linux-amd64.tar.gz"
2022-01-09 08:52:56 +00:00
echo
2022-04-14 13:44:06 +00:00
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 && \
2022-07-04 07:23:57 +00:00
echo 'export PATH="$PATH:/usr/local/go/bin\"' >> $HOME/.profile && \
echo 'export GOPATH="$HOME/.go"' >> $HOME/.profile && \
2022-04-14 13:44:06 +00:00
# source ~/.profile && \
go version && \
echo "NOTE: now run 'source ~/.profile' to apply new env vars"