mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-22 13:14:41 +00:00
buildGoApplication: Introduce ldflags argument
Previously it was not possible to define multiple ldflags, since only
the last definition applies, and there's some quoting issues with
`buildFlagsArray`. With the new `ldflags` argument it's possible to do
this, e.g.
ldflags = drv.ldflags or [] ++ [
"-X main.Version=1.0"
]
can now properly append a flag without clearing all previous ldflags.
This is a port of 155ae682a5
This commit is contained in:
parent
c5da508f3c
commit
24c5e41124
1 changed files with 1 additions and 1 deletions
|
@ -260,7 +260,7 @@ let
|
|||
echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0
|
||||
[ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
|
||||
local OUT
|
||||
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then
|
||||
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
|
||||
if echo "$OUT" | grep -qE 'imports .*?: no Go files in'; then
|
||||
echo "$OUT" >&2
|
||||
return 1
|
||||
|
|
Loading…
Reference in a new issue