Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions pkgs/development/go-modules/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,22 @@ let
exclude+='\)'

buildGoDir() {
local d; local cmd;
cmd="$1"
d="$2"
local cmd="$1" dir="$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 $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
echo "$OUT" >&2
return 1
Expand Down Expand Up @@ -244,7 +254,7 @@ let
runHook preCheck

for pkg in $(getGoDirs test); do
buildGoDir test $checkFlags "$pkg"
buildGoDir test "$pkg"
done

runHook postCheck
Expand Down
20 changes: 15 additions & 5 deletions pkgs/development/go-packages/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,22 @@ let
exclude+='\)'

buildGoDir() {
local d; local cmd;
cmd="$1"
d="$2"
local cmd="$1" dir="$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 $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
echo "$OUT" >&2
return 1
Expand Down Expand Up @@ -225,7 +235,7 @@ let
runHook preCheck

for pkg in $(getGoDirs test); do
buildGoDir test $checkFlags "$pkg"
buildGoDir test "$pkg"
done

runHook postCheck
Expand Down