From 590b061383c170d1f70a2f81fc6ac1f051cce11e Mon Sep 17 00:00:00 2001 From: Alvin Huang <17609145+alvin-huang@users.noreply.github.com> Date: Wed, 2 Oct 2019 14:32:44 -0400 Subject: [PATCH] check for go binary in ci builds (#6570) --- build-support/functions/00-vars.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build-support/functions/00-vars.sh b/build-support/functions/00-vars.sh index 11c5fe608..f4705f5d1 100644 --- a/build-support/functions/00-vars.sh +++ b/build-support/functions/00-vars.sh @@ -9,13 +9,15 @@ GO_BUILD_CONTAINER_DEFAULT="consul-build-go" COLORIZE=${COLORIZE-1} # determine GOPATH and the first GOPATH to use for intalling binaries -GOPATH=${GOPATH:-$(go env GOPATH)} -case $(uname) in - CYGWIN*) - GOPATH="$(cygpath $GOPATH)" - ;; -esac -MAIN_GOPATH=$(cut -d: -f1 <<< "${GOPATH}") +if command -v go >/dev/null; then + GOPATH=${GOPATH:-$(go env GOPATH)} + case $(uname) in + CYGWIN*) + GOPATH="$(cygpath $GOPATH)" + ;; + esac + MAIN_GOPATH=$(cut -d: -f1 <<< "${GOPATH}") +fi # Build debugging output is off by default BUILD_DEBUG=${BUILD_DEBUG-0}