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 <A.Garipov@AdGuard.COM>
Date:   Thu Jun 10 20:42:19 2021 +0300

    scripts: fix p in go-build
This commit is contained in:
Ainar Garipov 2021-06-10 20:47:58 +03:00
parent e0d89ba267
commit fcbf4fbc09
1 changed files with 10 additions and 6 deletions

View File

@ -88,11 +88,17 @@ then
fi fi
# Allow users to limit the build's parallelism. # Allow users to limit the build's parallelism.
parallelism="${PARALLELISM:-0}" parallelism="${PARALLELISM:-}"
readonly parallelism readonly parallelism
p_flags="-p=${parallelism}" # Use GOFLAGS for -p, because -p=0 simply disables the build instead of leaving
readonly p_flags # the default value.
if [ "${parallelism}" != '' ]
then
GOFLAGS="${GOFLAGS:-} -p=${parallelism}"
fi
readonly GOFLAGS
export GOFLAGS
# Allow users to specify a different output name. # Allow users to specify a different output name.
out="${OUT:-AdGuardHome}" out="${OUT:-AdGuardHome}"
@ -117,6 +123,4 @@ CGO_ENABLED="$cgo_enabled"
GO111MODULE='on' GO111MODULE='on'
export CGO_ENABLED GO111MODULE export CGO_ENABLED GO111MODULE
# Don't use quotes with flag variables to get word splitting. "$go" build --ldflags "$ldflags" "$race_flags" --trimpath "$o_flags" "$v_flags" "$x_flags"
"$go" build --ldflags "$ldflags" "$race_flags" --trimpath "$o_flags" "$p_flags" "$v_flags"\
"$x_flags"