-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildGoModule: Introduce ldflags argument #125520
Conversation
Result of 3 packages marked as broken and skipped:
696 packages skipped due to time constraints:
4 packages built successfully:
|
Can this be backported to 21.05 or is it too late? |
I think backporting this would be fine and may even be somewhat necessary so that go package backports aren't a hassle. |
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.
I won't be doing the backport myself but I'd suggest that it be backported with #125597 to limit the number of rebuilds. |
@zowoq Should it be backported with the next Go release then? |
Motivation for this change
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 newldflags
argument it's possible to dothis, e.g.
can now properly append a flag without clearing all previous ldflags.
Pretty much fixes #112054, ping @jtojnar @Mic92 @kalbasit @kvtb
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)