Skip to content

Commit e11568d

Browse files
committed
Revert "Merge #171177: go-modules/packages: Improve checkFlags handling"
This reverts commit 361139c, reversing changes made to 77ee91f. 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
1 parent 74783b7 commit e11568d

2 files changed

Lines changed: 10 additions & 30 deletions

File tree

pkgs/development/go-modules/generic/default.nix

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,12 @@ let
180180
exclude+='\)'
181181
182182
buildGoDir() {
183-
local cmd="$1" dir="$2"
184-
183+
local d; local cmd;
184+
cmd="$1"
185+
d="$2"
185186
. $TMPDIR/buildFlagsArray
186-
187-
declare -a flags
188-
flags+=($buildFlags "''${buildFlagsArray[@]}")
189-
flags+=(''${tags:+-tags=${lib.concatStringsSep "," tags}})
190-
flags+=(''${ldflags:+-ldflags="$ldflags"})
191-
flags+=("-v" "-p" "$NIX_BUILD_CORES")
192-
193-
if [ "$cmd" = "test" ]; then
194-
flags+=($checkFlags)
195-
fi
196-
197187
local OUT
198-
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
188+
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
199189
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
200190
echo "$OUT" >&2
201191
return 1
@@ -253,7 +243,7 @@ let
253243
runHook preCheck
254244
255245
for pkg in $(getGoDirs test); do
256-
buildGoDir test "$pkg"
246+
buildGoDir test $checkFlags "$pkg"
257247
done
258248
259249
runHook postCheck

pkgs/development/go-packages/generic/default.nix

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,12 @@ let
160160
exclude+='\)'
161161
162162
buildGoDir() {
163-
local cmd="$1" dir="$2"
164-
163+
local d; local cmd;
164+
cmd="$1"
165+
d="$2"
165166
. $TMPDIR/buildFlagsArray
166-
167-
declare -a flags
168-
flags+=($buildFlags "''${buildFlagsArray[@]}")
169-
flags+=(''${tags:+-tags=${lib.concatStringsSep "," tags}})
170-
flags+=(''${ldflags:+-ldflags="$ldflags"})
171-
flags+=("-v" "-p" "$NIX_BUILD_CORES")
172-
173-
if [ "$cmd" = "test" ]; then
174-
flags+=($checkFlags)
175-
fi
176-
177167
local OUT
178-
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
168+
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
179169
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
180170
echo "$OUT" >&2
181171
return 1
@@ -235,7 +225,7 @@ let
235225
runHook preCheck
236226
237227
for pkg in $(getGoDirs test); do
238-
buildGoDir test "$pkg"
228+
buildGoDir test $checkFlags "$pkg"
239229
done
240230
241231
runHook postCheck

0 commit comments

Comments
 (0)