Skip to content

Instantly share code, notes, and snippets.

@kemalelmizan
Last active September 26, 2022 23:55
Show Gist options
  • Save kemalelmizan/68ce2864589a3de294425c5bed409ad8 to your computer and use it in GitHub Desktop.
Save kemalelmizan/68ce2864589a3de294425c5bed409ad8 to your computer and use it in GitHub Desktop.
Setup go in ~
VER="1.16.5"
PREV_VER="1.16.3"
sudo rm /usr/bin/go
curl -O https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz
mkdir -p ~/go1.16.5 && tar -C ~/go1.16.5 -xzf go1.16.5.linux-amd64.tar.gz && rm go1.16.5.linux-amd64.tar.gz
cd ~/go1.16.5 && [ -d ./go ] && mv go/* . && rm -rf go
export PATH=$PATH:`pwd`/bin
cd src
GOROOT_BOOTSTRAP=`$HOME`/go1.16.3 ./all.bash
go version
# Clone from source:
git clone https://go.googlesource.com/go ~/go
cd ~/go
git checkout go1.16.5
# Build from source using gccgo:
sudo apt-get install gccgo
sudo update-alternatives --install /usr/bin/go go /usr/bin/go-10 1
cd ~/go/src
GOROOT_BOOTSTRAP=/usr ./all.bash
# Build from source using previous go installation:
sudo update-alternatives --remove go /usr/bin/go
sudo rm /usr/bin/go
cd ~
GOROOT_BOOTSTRAP=`pwd`/go1.16.3 ./all.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment