hack/make: Don't add -buildmode=pie with -race

Make it possible to add `-race` to the BUILDFLAGS without making the
build fail with error:
"-buildmode=pie not supported when -race is enabled"

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-01-05 20:32:46 +01:00
parent 6ddb3ba414
commit d645297358
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -70,14 +70,17 @@ hash_files() {
esac
fi
# -buildmode=pie is not supported on Windows and Linux on mips and riscv64.
case "$(go env GOOS)/$(go env GOARCH)" in
windows/* | linux/mips* | linux/riscv*) ;;
# -buildmode=pie not supported when -race is enabled
if [[ " $BUILDFLAGS " != *" -race "* ]]; then
# -buildmode=pie is not supported on Windows and Linux on mips and riscv64.
case "$(go env GOOS)/$(go env GOARCH)" in
windows/* | linux/mips* | linux/riscv*) ;;
*)
BUILDFLAGS+=("-buildmode=pie")
;;
esac
*)
BUILDFLAGS+=("-buildmode=pie")
;;
esac
fi
echo "Building: $DEST/$BINARY_FULLNAME"
echo "GOOS=\"${GOOS}\" GOARCH=\"${GOARCH}\" GOARM=\"${GOARM}\""