Skip to content
Discussion options

You must be logged in to vote

Hey, thanks for reaching out.

To answer the larger question on why we recommend compiling with optimizations disabled (and do by default with debug / test / trace) is because historically the DWARF debugging information present in optimized Go binaries tended to be sometimes inaccurate or incomplete when certain optimizations were applied. Also, even if the debug information was correct / present, the underlying value may have been optimized away anyways. Also, line number information tended to be incorrect when inlining was enabled, etc...

A lot of these problems have in fact been fixed and addressed either in the Go compiler itself (thanks Go team!) or worked around in Delve, so while s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Alfus
Comment options

Answer selected by derekparker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #4165 on September 26, 2025 17:12.