Skip to content

Instantly share code, notes, and snippets.

@duccas
Last active January 25, 2021 20:47
Show Gist options
  • Save duccas/c9319f56e09603c2a3aefae80ae98994 to your computer and use it in GitHub Desktop.
Save duccas/c9319f56e09603c2a3aefae80ae98994 to your computer and use it in GitHub Desktop.
#!/bin/bash
VERSION=$1
if [ "$VERSION" == "" ]; then
VERSION="1.15.6"
fi
sudo apt-get remove golang-go -y \
&& rm -rf /usr/local/go \
&& rm -rf $HOME/go \
&& wget https://golang.org/dl/go$VERSION.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz \
&& echo 'export PATH=$PATH:/usr/local/go/bin:$PATH:$GOPATH/bin' >> $HOME/.bashrc \
&& echo 'export GOPATH=~/go' >> $HOME/.bashrc \
&& echo 'export GOBIN=$GOPATH/bin' >> $HOME/.bashrc \
&& source ~/.bashrc
echo "--------GOLANG VERSION $VERSION INSTALLED--------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment