Building Go Binaries Without Debug Information

Is it possible to build a go binary so that it doesn't display the stack trace in panic and doesn't contain the source paths, etc.?

I am currently using ld-flags "-w" and "-s" but as a result the binary still contains some unnecessary paths and shows an unnecessary stack trace when panicked.

There is a problem with this ( https://code.google.com/p/go/issues/detail?id=3467 ), but it is outdated and hasn't been updated in a while (and I have no idea that "fix runtime" in one of the problems means comments).

+3


source to share


1 answer


No, there is no way to do it right now.



The comment about the runtime fix means that this is currently the only way to disable this output. The runtime is what prints panic stack traces and segfault addresses; and you will have to write a patch to disable this behavior.

+3


source







All Articles