Skip to content

Instantly share code, notes, and snippets.

@fuzzy
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save fuzzy/e0a075b5c5034f471358 to your computer and use it in GitHub Desktop.

Select an option

Save fuzzy/e0a075b5c5034f471358 to your computer and use it in GitHub Desktop.
bootstrap for go1.5
#!/bin/sh
go14src=https://storage.googleapis.com/golang/go1.4.2.src.tar.gz
go14fnm=$(basename ${go14src})
bootstrap() {
cd /tmp
wget ${go14src}
tar zxf ${go14fnm}
cd /tmp/go/src
./make.bash
}
# Do we have a go at all?
test ! -z "$(which go 2>/dev/null)" && go=$(which go)
# And if so, is it
(test -z "${go}" || test -z "$(${go} version|grep go1.4)") && bootstrap
cd ~
mkdir -p ~/.godev/$(uname -s)/$(uname -m)/gopath
cd ~/.godev/$(uname -s)/$(uname -m)
git clone https://github.com/golang/go.git goroot
cd goroot/src
env GOROOT_BOOTSTRAP=/tmp/go ./make.bash || exit 1
rm -rf /tmp/${go14fnm} /tmp/go
echo "You will want to add the following to your ~/.profile or ~/.bashrc or whatever."
echo "export PATH=\${HOME}/.godev/\$(uname -s)/\$(uname -m)/goroot/bin:\${PATH}"
echo "export GOROOT=\${HOME}/.godev/\$(uname -s)/\$(uname -m)/goroot"
echo "export GOPATH=\${HOME}/.godev/\$(uname -s)/\$(uname -m)/gopath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment