Revert "Merge #171177: go-modules/packages: Improve checkFlags handling"

This reverts commit 361139c574, reversing
changes made to 77ee91f1d3.

This broke tests in some go packages, and at this point I don't want
further delays from figuring out what's wrong.  This probably won't
make it to 22.05.  Example failures:
  https://hydra.nixos.org/build/176551928
  https://hydra.nixos.org/build/176546993
but I think there were more among
  https://hydra.nixos.org/eval/1762178?compare=1762151#tabs-now-fail
This commit is contained in:
Vladimír Čunát 2022-05-17 11:47:41 +02:00
parent 74783b72bc
commit e11568dd9c
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
2 changed files with 10 additions and 30 deletions

View file

@ -180,22 +180,12 @@ let
exclude+='\)'
buildGoDir() {
local cmd="$1" dir="$2"
local d; local cmd;
cmd="$1"
d="$2"
. $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
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
echo "$OUT" >&2
return 1
@ -253,7 +243,7 @@ let
runHook preCheck
for pkg in $(getGoDirs test); do
buildGoDir test "$pkg"
buildGoDir test $checkFlags "$pkg"
done
runHook postCheck

View file

@ -160,22 +160,12 @@ let
exclude+='\)'
buildGoDir() {
local cmd="$1" dir="$2"
local d; local cmd;
cmd="$1"
d="$2"
. $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
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
echo "$OUT" >&2
return 1
@ -235,7 +225,7 @@ let
runHook preCheck
for pkg in $(getGoDirs test); do
buildGoDir test "$pkg"
buildGoDir test $checkFlags "$pkg"
done
runHook postCheck