Skip to content
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

proposal: cmd/go: add -debug or -dwarf flag #38777

Open
josharian opened this issue Apr 30, 2020 · 2 comments
Open

proposal: cmd/go: add -debug or -dwarf flag #38777

josharian opened this issue Apr 30, 2020 · 2 comments
Labels
Milestone

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Apr 30, 2020

Many gophers know that they can strip DWARF from their binaries with -ldflags=-w. But this is fairly cryptic, and it doesn't give the compiler the opportunity to save time and space by not generating that DWARF in the first place.

I propose we add support directly to cmd/go to say -debug=false or -dwarf=false or the like. Then cmd/go would translate that into the appropriate compiler and linker flags.

@gopherbot gopherbot added this to the Proposal milestone Apr 30, 2020
@gopherbot gopherbot added the Proposal label Apr 30, 2020
@mvdan
Copy link
Member

@mvdan mvdan commented May 1, 2020

I wonder if this would be a net win overall, assuming that using -ldflags=-w or not doesn't affect the compiler, so both versions can share the build cache entirely.

@mvdan
Copy link
Member

@mvdan mvdan commented May 1, 2020

Here's one case where it could help build speed a lot, though - single production builds from scratch, such as those that happen inside Dockerfiles, or on CI/CD machines. Those often exclude debug information, and they rarely have a warm build cache, given that they're not developer machines. For the same reason, they tend to compile a lot of packages from scratch, so even saving 2% of the compiler's work would be noticeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.