scripts: set PACKER_RACE to build with race detector
This commit is contained in:
parent
aa383885c5
commit
415fb2c935
|
@ -20,9 +20,16 @@ cd $DIR
|
||||||
GIT_COMMIT=$(git rev-parse HEAD)
|
GIT_COMMIT=$(git rev-parse HEAD)
|
||||||
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
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
|
# Compile the main Packer app
|
||||||
echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}"
|
echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}"
|
||||||
go build \
|
go build \
|
||||||
|
${PACKER_RACE} \
|
||||||
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
||||||
-v \
|
-v \
|
||||||
-o bin/packer .
|
-o bin/packer .
|
||||||
|
@ -32,6 +39,7 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
|
||||||
PLUGIN_NAME=$(basename ${PLUGIN})
|
PLUGIN_NAME=$(basename ${PLUGIN})
|
||||||
echo -e "${OK_COLOR}--> Compiling Plugin: ${PLUGIN_NAME}${NO_COLOR}"
|
echo -e "${OK_COLOR}--> Compiling Plugin: ${PLUGIN_NAME}${NO_COLOR}"
|
||||||
go build \
|
go build \
|
||||||
|
${PACKER_RACE} \
|
||||||
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
||||||
-v \
|
-v \
|
||||||
-o bin/packer-${PLUGIN_NAME} ${PLUGIN}
|
-o bin/packer-${PLUGIN_NAME} ${PLUGIN}
|
||||||
|
|
Loading…
Reference in New Issue