mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 12:59:04 +02:00
Merge pull request #171177 from bdd/go-checkFlags
go-modules/packages: Improve `checkFlags` handling
This commit is contained in:
commit
361139c574
|
@ -181,12 +181,22 @@ let
|
||||||
exclude+='\)'
|
exclude+='\)'
|
||||||
|
|
||||||
buildGoDir() {
|
buildGoDir() {
|
||||||
local d; local cmd;
|
local cmd="$1" dir="$2"
|
||||||
cmd="$1"
|
|
||||||
d="$2"
|
|
||||||
. $TMPDIR/buildFlagsArray
|
. $TMPDIR/buildFlagsArray
|
||||||
|
|
||||||
|
declare -a flags
|
||||||
|
flags+=($buildFlags "''${buildFlagsArray[@]}")
|
||||||
|
flags+=(''${tags:+-tags=${lib.concatStringsSep "," tags}})
|
||||||
|
flags+=(''${ldflags:+-ldflags="$ldflags"})
|
||||||
|
flags+=("-v" "-p" "$NIX_BUILD_CORES")
|
||||||
|
|
||||||
|
if [ "$cmd" = "test" ]; then
|
||||||
|
flags+=($checkFlags)
|
||||||
|
fi
|
||||||
|
|
||||||
local OUT
|
local OUT
|
||||||
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
|
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
|
||||||
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
||||||
echo "$OUT" >&2
|
echo "$OUT" >&2
|
||||||
return 1
|
return 1
|
||||||
|
@ -244,7 +254,7 @@ let
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
|
|
||||||
for pkg in $(getGoDirs test); do
|
for pkg in $(getGoDirs test); do
|
||||||
buildGoDir test $checkFlags "$pkg"
|
buildGoDir test "$pkg"
|
||||||
done
|
done
|
||||||
|
|
||||||
runHook postCheck
|
runHook postCheck
|
||||||
|
|
|
@ -160,12 +160,22 @@ let
|
||||||
exclude+='\)'
|
exclude+='\)'
|
||||||
|
|
||||||
buildGoDir() {
|
buildGoDir() {
|
||||||
local d; local cmd;
|
local cmd="$1" dir="$2"
|
||||||
cmd="$1"
|
|
||||||
d="$2"
|
|
||||||
. $TMPDIR/buildFlagsArray
|
. $TMPDIR/buildFlagsArray
|
||||||
|
|
||||||
|
declare -a flags
|
||||||
|
flags+=($buildFlags "''${buildFlagsArray[@]}")
|
||||||
|
flags+=(''${tags:+-tags=${lib.concatStringsSep "," tags}})
|
||||||
|
flags+=(''${ldflags:+-ldflags="$ldflags"})
|
||||||
|
flags+=("-v" "-p" "$NIX_BUILD_CORES")
|
||||||
|
|
||||||
|
if [ "$cmd" = "test" ]; then
|
||||||
|
flags+=($checkFlags)
|
||||||
|
fi
|
||||||
|
|
||||||
local OUT
|
local OUT
|
||||||
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
|
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
|
||||||
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
||||||
echo "$OUT" >&2
|
echo "$OUT" >&2
|
||||||
return 1
|
return 1
|
||||||
|
@ -225,7 +235,7 @@ let
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
|
|
||||||
for pkg in $(getGoDirs test); do
|
for pkg in $(getGoDirs test); do
|
||||||
buildGoDir test $checkFlags "$pkg"
|
buildGoDir test "$pkg"
|
||||||
done
|
done
|
||||||
|
|
||||||
runHook postCheck
|
runHook postCheck
|
||||||
|
|
Loading…
Reference in a new issue