Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 155 lines (122 sloc) 4.56 KB
#!/bin/bash
exec &> "$HOME/update_go.log"
export GOBIN=""
export GOPATH=""
# Get the Native Client SDK
if [[ ! -d "$HOME/.nacl_sdk" ]]
then
cd "$HOME"
rm -f .nacl_sdk.zip
wget -O .nacl_sdk.zip "https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip"
unzip .nacl_sdk.zip
mv "nacl_sdk" ".nacl_sdk"
rm -f .nacl_sdk.zip
fi
cd "$HOME/.nacl_sdk"
./naclsdk update --force
nacl_version=$(./naclsdk list | grep -o 'pepper_\([0-9]\+\) (stable)' | cut -f1 -d' ')
# Get Go's source code
if [[ ! -d "$HOME/.golang" ]]
then
git clone "https://go.googlesource.com/go" "$HOME/.golang"
fi
cd "$HOME/.golang"
git pull
git log --after=$(date --date="yesterday" +"%Y-%m-%dT04:00:00")
# Bootstrap
rm -rf "$HOME/.golang-bootstrap/"go-*
for v in 1.4 1.5 1.6 1.7
do
if [[ "$v" == "1.4" ]]
then
# https://golang.org/issue/13114
cgo=0
else
cgo=1
fi
git clone --depth 1 -b "release-branch.go$v" --reference "$HOME/.golang" "https://go.googlesource.com/go" "$HOME/.golang-bootstrap/go-$v"
(cd "$HOME/.golang-bootstrap/go-$v/src" && CGO_ENABLED=$cgo ./make.bash)
export GOROOT_BOOTSTRAP="$HOME/.golang-bootstrap/go-$v"
done
# Symlinks as defined in misc/nacl/README
mkdir -p bin
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/sel_ldr_x86_32" "$HOME/.golang/bin/sel_ldr_x86_32"
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/sel_ldr_x86_64" "$HOME/.golang/bin/sel_ldr_x86_64"
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/sel_ldr_arm" "$HOME/.golang/bin/sel_ldr_arm"
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/nacl_helper_bootstrap_x86_32" "$HOME/.golang/bin/nacl_helper_bootstrap_x86_32"
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/nacl_helper_bootstrap_x86_64" "$HOME/.golang/bin/nacl_helper_bootstrap_x86_64"
ln -nfs "$HOME/.nacl_sdk/$nacl_version/tools/nacl_helper_bootstrap_arm" "$HOME/.golang/bin/nacl_helper_bootstrap_arm"
ln -nfs "$HOME/.golang/misc/nacl/go_nacl_amd64p32_exec" "$HOME/.golang/bin/go_nacl_amd64p32_exec"
ln -nfs "$HOME/.golang/misc/nacl/go_nacl_386_exec" "$HOME/.golang/bin/go_nacl_386_exec"
ln -nfs "$HOME/.golang/misc/nacl/go_nacl_arm_exec" "$HOME/.golang/bin/go_nacl_arm_exec"
# And now we compile!
cd src
./all.bash
# build the standard library for Go
../bin/go install -a std
# Grab the correct PATH variable
source "$HOME/.profile"
GOBIN=/tmp/go-tools-garbage ../bin/go get -u -v \
github.com/gopherjs/gopherjs/js \
golang.org/x/arch/... \
golang.org/x/benchmarks/... \
golang.org/x/blog/... \
golang.org/x/build/... \
golang.org/x/crypto/... \
golang.org/x/debug/... \
golang.org/x/exp/... \
golang.org/x/image/... \
golang.org/x/mobile/... \
golang.org/x/net/... \
golang.org/x/oauth2/... \
golang.org/x/playground/... \
golang.org/x/sync/... \
golang.org/x/sys/... \
golang.org/x/talks/... \
golang.org/x/text/... \
golang.org/x/time/... \
golang.org/x/tools/... \
golang.org/x/tour/... \
google.golang.org/api/... \
google.golang.org/appengine/... \
google.golang.org/cloud/... \
google.golang.org/grpc/...
if [[ -d "$HOME/.golang-path/src" ]]; then
find "$HOME/.golang-path/src" -name .git -type d -print -exec bash -ec 'cd "$0/.." && git pull && git submodule update --init --recursive' {} \;
fi
# Install some utilities
old_GOPATH="$GOPATH"
old_GOBIN="$GOBIN"
export GOBIN="${old_GOBIN:-`cut -d: -f1 <<< "$old_GOPATH"`/bin}"
export GOPATH="$HOME/.golang-bootstrap/path"
../bin/go get -u -v \
github.com/alecthomas/gometalinter \
github.com/cortesi/devd/cmd/devd \
github.com/derekparker/delve/cmd/dlv \
github.com/garyburd/go-explorer/src/getool \
github.com/golang/lint/golint \
github.com/jstemmer/gotags \
github.com/kisielk/errcheck \
github.com/nsf/gocode \
github.com/rogpeppe/godef \
golang.org/x/review/git-codereview \
golang.org/x/tools/cmd/benchcmp \
golang.org/x/tools/cmd/cover \
golang.org/x/tools/cmd/godoc \
golang.org/x/tools/cmd/goimports \
golang.org/x/tools/cmd/gorename \
golang.org/x/tools/cmd/oracle \
golang.org/x/tools/cmd/ssadump
# gopherjs doesn't work on development versions of Go.
"$HOME/.golang-bootstrap/go-1.7/bin/go" get -u -v \
github.com/gopherjs/gopherjs
(cd "$HOME/.golang-bootstrap/path/src/github.com/gopherjs/gopherjs/node-syscall" && \
node-gyp rebuild && \
mkdir -p "$HOME/.node_libraries" && \
cp build/Release/syscall.node "$HOME/.node_libraries/")
"$GOBIN/gometalinter" --install --update
export GOPATH="$old_GOPATH"
export GOBIN="$old_GOBIN"
[[ -d "$HOME/.vim/bundle/vim-go" ]] && (cd "$HOME/.vim/bundle/vim-go" && git pull)
[[ -d "$HOME/.vim/bundle/tagbar" ]] && (cd "$HOME/.vim/bundle/tagbar" && git pull)
[[ -d "$HOME/.vim/bundle/go-explorer" ]] && (cd "$HOME/.vim/bundle/go-explorer" && git pull)