You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enhancement: Add -gcflags option for statically compiling binary #518
Describe the feature
Currently, there is an -ldflags argument that passes arguments directly to go build during compilation. This would aim to add a parallel for the gcflags build flags setting as well.
What problem does this feature address?
While there are probably other uses out there that I don't know about, the once instance of this that stands out to me is removing compiler optimizations from built code for debugging. Currently, trying to launch a compiled magefile binary using dlv results in often subpar information due to compiler optimizations, and the means of removing said optimizations require passing gcflags arguments.
Additional context
While a separate flag could be made to disable compiler optimizations, this would be a more general-purpose solution.
Another option would be adding a general "build" flag that passes on its arguments directly to go build, though that might pose backwards compatibility issues.
For the record, the debug setup I am using simply has mage handle compiling the binary and dlv run the finished product afterwards.
Activity