Skip to content

Instantly share code, notes, and snippets.

@rubeniskov
Last active June 13, 2018 03:23
Show Gist options
  • Save rubeniskov/ce2683ce045d6efb72676af055e59d50 to your computer and use it in GitHub Desktop.
Save rubeniskov/ce2683ce045d6efb72676af055e59d50 to your computer and use it in GitHub Desktop.
Install golang 1.10 from source
GOROOT_BOOTSTRAP=/tmp/go1.4; BASHRC=$(ls ~/.bash*|grep 'rc\|_profile'|head -n1); { \
mkdir -p $GOROOT_BOOTSTRAP; \
curl -s https://dl.google.com/go/go1.4.3.src.tar.gz | tar -zx --strip-components=1 -C $GOROOT_BOOTSTRAP; \
cd $GOROOT_BOOTSTRAP/src && ./make.bash; \
curl -s https://dl.google.com/go/go1.10.3.src.tar.gz | tar -zx -C /tmp/;
cd /tmp/go/src && ./make.bash; mv -f /tmp/go /usr/local/; \
sed -i '/^export GOROOT=/{h;s/=.*/=\/usr\/local\/go/};${x;/^$/{s//export GOROOT=\/usr\/local\/go/;H};x}' ${BASHRC}; \
sed -i '/^export GOPATH=/{h;s/=.*/=${HOME}\/go/};${x;/^$/{s//export GOPATH=${HOME}\/go/;H};x}' ${BASHRC}; \
sed -i '/^export PATH=/{h;s/=.*/=${PATH}:${GOPATH}\/bin/};${x;/^$/{s//export PATH=${PATH}:${GOPATH}\/bin/;H};x}' ${BASHRC}; \
}; source $BASHRC; go version; go env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment