From 415fb2c935a23942a0e7a1a49688fa91c530c80b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 21 Aug 2013 11:15:09 -0700 Subject: [PATCH] scripts: set PACKER_RACE to build with race detector --- scripts/build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/build.sh b/scripts/build.sh index 1e1701c11..5d0059da0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,9 +20,16 @@ cd $DIR GIT_COMMIT=$(git rev-parse HEAD) GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) +# If we're building a race-enabled build, then set that up. +if [ ! -z $PACKER_RACE ]; then + echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}" + PACKER_RACE="-race" +fi + # Compile the main Packer app echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}" go build \ + ${PACKER_RACE} \ -ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ -v \ -o bin/packer . @@ -32,6 +39,7 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do PLUGIN_NAME=$(basename ${PLUGIN}) echo -e "${OK_COLOR}--> Compiling Plugin: ${PLUGIN_NAME}${NO_COLOR}" go build \ + ${PACKER_RACE} \ -ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ -v \ -o bin/packer-${PLUGIN_NAME} ${PLUGIN}