buildGoModule: access `ldflags` and `tags` `__structuredAttrs`-agnostically (#360037)

Changed files
+3 -3
pkgs
build-support
+3 -3
pkgs/build-support/go/module.nix
···
local cmd="$1" dir="$2"
declare -a flags
-
flags+=(''${tags:+-tags=''${tags// /,}})
-
flags+=(''${ldflags:+-ldflags="$ldflags"})
flags+=("-p" "$NIX_BUILD_CORES")
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
flags+=(-x)
···
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
# normalize cross-compiled builds w.r.t. native builds
(
-
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
mv $dir/* $dir/..
fi
···
local cmd="$1" dir="$2"
declare -a flags
+
flags+=(''${tags:+-tags=$(concatStringsSep "," tags)})
+
flags+=(''${ldflags:+-ldflags="''${ldflags[*]}"})
flags+=("-p" "$NIX_BUILD_CORES")
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
flags+=(-x)
···
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
# normalize cross-compiled builds w.r.t. native builds
(
+
dir=$GOPATH/bin/''${GOOS}_''${GOARCH}
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
mv $dir/* $dir/..
fi