Skip to content

Instantly share code, notes, and snippets.

@danderson
Created November 27, 2011 00:49
Show Gist options
  • Save danderson/1396652 to your computer and use it in GitHub Desktop.
Save danderson/1396652 to your computer and use it in GitHub Desktop.
Utility scripts to maintain 32/64 bit builds of Go, and easily switch between them.
function go-switch() {
eval `command go-switch $@`
rehash
}
#!/bin/bash
set -e
if [[ -z $1 ]]; then
echo "Usage: $0 386|amd64"
exit 1
fi
case $1 in
386|amd64)
if [[ -e ~/go ]]; then
if [[ -L ~/go ]]; then
rm ~/go
else
echo "~/go exists and is not a symlink, aborting"
exit 1
fi
fi
ln -s ~/go-builds/$1 ~/go
;;
*)
echo "Unknown arch $1"
exit 1
esac
#!/bin/bash
ROOT=$HOME/go-builds
mkdir -p $ROOT
if [[ -d $ROOT/upstream ]]; then
(cd $ROOT/upstream && hg pull)
else
(cd $ROOT && hg clone https://go.googlecode.com/hg/ upstream)
fi
for arch in 386 amd64; do
(
cd $ROOT
rm -rf $arch
hg clone -u weekly upstream $arch
export GOROOT=$ROOT/$arch
export GOARCH=$arch
cd $GOROOT/src
./all.bash
)&
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment