Fix for issue #101, switch back from master branch if building locally

This commit is contained in:
Cameron Sparr 2015-08-11 09:46:06 -06:00
parent 9f2e6d6172
commit 374a0af084
1 changed files with 8 additions and 0 deletions

View File

@ -167,10 +167,18 @@ do_build() {
for b in ${BINS[*]}; do for b in ${BINS[*]}; do
rm -f $GOPATH_INSTALL/bin/$b rm -f $GOPATH_INSTALL/bin/$b
done done
# If the branch has an upstream, go get switches to master for some reason
# unsetting the upstream causes go get to stay on the current branch, but
# is admittedly a little annoying
git branch --unset-upstream
if [ $? == 0 ]; then
echo "WARNING: upstream branch unset for go get command to work"
fi
go get -u -f ./... go get -u -f ./...
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "WARNING: failed to 'go get' packages." echo "WARNING: failed to 'go get' packages."
fi fi
go install -a -ldflags="-X main.Version $version -X main.Commit $commit" ./... go install -a -ldflags="-X main.Version $version -X main.Commit $commit" ./...
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Build failed, unable to create package -- aborting" echo "Build failed, unable to create package -- aborting"