From 319366513c57379b781e8aa2d305610aad37716b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 20 Apr 2019 11:53:46 +0100 Subject: [PATCH] Allow building with race detector --- build | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build b/build index f76ee7b..bad287f 100755 --- a/build +++ b/build @@ -8,7 +8,7 @@ PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)} LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER" -while getopts "udaitc:l:" option +while getopts "udaitc:l:r" option do case "${option}" in @@ -19,6 +19,7 @@ do t) TABLES=true;; c) GCFLAGS="$GCFLAGS $OPTARG";; l) LDFLAGS="$LDFLAGS $OPTARG";; + r) RACE="-race";; esac done @@ -43,9 +44,9 @@ else echo "Building: $CMD" if [ $DEBUG ]; then - go build -ldflags="$LDFLAGS" -gcflags="$GCFLAGS" -tags debug -v ./cmd/$CMD + go build $RACE -ldflags="$LDFLAGS" -gcflags="$GCFLAGS" -tags debug -v ./cmd/$CMD else - go build -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" -v ./cmd/$CMD + go build $RACE -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" -v ./cmd/$CMD fi if [ $UPX ]; then upx --brute $CMD