From fcbf4fbc091166254c1f8b679aa583f988e2f3ef Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 10 Jun 2021 20:47:58 +0300 Subject: [PATCH] Pull request: scripts: fix p in go-build Merge in DNS/adguard-home from fix-p to master Squashed commit of the following: commit bb85f324dc6c87c0bea5bec0788eba528cb07525 Author: Ainar Garipov Date: Thu Jun 10 20:42:19 2021 +0300 scripts: fix p in go-build --- scripts/make/go-build.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/make/go-build.sh b/scripts/make/go-build.sh index be231ad1..d6b86f51 100644 --- a/scripts/make/go-build.sh +++ b/scripts/make/go-build.sh @@ -88,11 +88,17 @@ then fi # Allow users to limit the build's parallelism. -parallelism="${PARALLELISM:-0}" +parallelism="${PARALLELISM:-}" readonly parallelism -p_flags="-p=${parallelism}" -readonly p_flags +# Use GOFLAGS for -p, because -p=0 simply disables the build instead of leaving +# the default value. +if [ "${parallelism}" != '' ] +then + GOFLAGS="${GOFLAGS:-} -p=${parallelism}" +fi +readonly GOFLAGS +export GOFLAGS # Allow users to specify a different output name. out="${OUT:-AdGuardHome}" @@ -117,6 +123,4 @@ CGO_ENABLED="$cgo_enabled" GO111MODULE='on' export CGO_ENABLED GO111MODULE -# Don't use quotes with flag variables to get word splitting. -"$go" build --ldflags "$ldflags" "$race_flags" --trimpath "$o_flags" "$p_flags" "$v_flags"\ - "$x_flags" +"$go" build --ldflags "$ldflags" "$race_flags" --trimpath "$o_flags" "$v_flags" "$x_flags"