-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
Expose an option or flag to disable stripping of symbols on go_test
targets without --@io_bazel_rules_go//go/config:debug
#4103
Comments
I would very much like to do what I like the idea of honoring |
By default, with no other flags set, Interestingly, the previous comments on the topic seem to suggest that |
@jayconrod Do you happen to know whether this changed? |
(I'm talking specifically about Linux, by the way. Mac seems to behave slightly differently.) |
As of #2573, builds of
go_test
targets will always result in a binary with its symbols. In #2691, it's reiterated this is working as intended.This behavior can be disabled with
--@io_bazel_rules_go//go/config:debug
, but that has the additional implication of disabling inlining. So, if you are trying to diagnose a problem or especially debug anything related to performance, this is not an option you realistically have as any investigation you will do will be on a generated binary that is probably substantively different from your production binary.In the GitHub issues discussing this, it's claimed that this behavior was adopted for a performance benefit. Maybe that is true (I haven't profiled anything using recent versions of
go
, although it's possible the situation has changed in 4 years), but there should be some option that one can apply to disable this stripping where relevant without enabling any other command-line flags that would impact the performance or behavior of the generated binary.I can see two obvious options:
--@io_bazel-rules_go//go/config:no_strip_tests
). Update the logic here to not add-s -w
if eitherdebug
orno_strip_tests
are set, instead of only checkingdebug
.--strip
, i.e. do not strip these binaries if--strip=never
is set.Alternatively this stripping behavior could be updated to be opt-in instead of mandatory. It could also be re-evaluated whether this optimization is needed on the latest versions of the Go SDK.
If it's agreed option 1 ("Provide a new flag...") is best, I can submit a PR to that effect.
The text was updated successfully, but these errors were encountered: