From e11568dd9cfccfeb1267199feafea247f444848e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 17 May 2022 11:47:41 +0200 Subject: [PATCH] Revert "Merge #171177: go-modules/packages: Improve `checkFlags` handling" This reverts commit 361139c574ab2a37c46cd705fac90ada130ea139, reversing changes made to 77ee91f1d318a03fa96571656ce8af25a236fbca. 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 --- .../go-modules/generic/default.nix | 20 +++++-------------- .../go-packages/generic/default.nix | 20 +++++-------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index d0dc55376faa..4dff2d82848d 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -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 diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index 643c1955d2b0..0559f7f07a7c 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -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