Repository navigation
Golang docs: remove "-s" and "-w" from the ldflags example - #274503
Conversation
The go linker `-s` and `-w` flags respectively are for: - Omit the symbol table and debug information. - Omit the DWARF symbol table. Those actions should be delegated to the fixup build phase instead. See: https://discourse.nixos.org/t/why-do-so-many-go-packages-use-s-w-in-their-ldflags-it-breaks-dontfixup-dontstrip/36843
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Successfully created backport PR for |
|
Did anyone bother checking the size difference on darwin? IIRC the fixup strip wasn't consistent across darwin/linux so binaries on darwin had extra bloat unless we used the golang strip. |
If it's needed then I feel that it should belong within |
I don't disagree but the last time that I looked at this I found it wasn't quite as simple as I'd had hoped it would be: #177698. I don't really care if these flags are included in the docs or not but at the moment I'm against removing these flags from packages and trying to enforce not adding them. I think it is likely that people will care more about binary size then they will about dontfixup/dontstrip not working. |
Thank you for the follow-up and the merge. It ended up being pretty difficult for me to understand why delve wouldn't work even with Just to make sure I understand:
|
The go linker
-sand-wflags respectively are for:Those actions should be delegated to the fixup build phase instead.
See: https://discourse.nixos.org/t/why-do-so-many-go-packages-use-s-w-in-their-ldflags-it-breaks-dontfixup-dontstrip/36843
Description of changes
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.