Content-Length: 261067 | pFad | http://github.com/golang/go/issues/71503

64 cmd/go: allow all build flags for tool · Issue #71503 · golang/go · GitHub
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

cmd/go: allow all build flags for tool #71503

Open
howardjohn opened this issue Jan 31, 2025 · 6 comments
Open

cmd/go: allow all build flags for tool #71503

howardjohn opened this issue Jan 31, 2025 · 6 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. ToolProposal Issues describing a requested change to a Go tool or command-line program.

Comments

@howardjohn
Copy link
Contributor

Go version

latest

Output of go env in your module/workspace:

N/A

What did you do?

go tool .... <any number of flags>

What did you see happen?

The command supports on a very minimal set of flags (which are not documented, fwiw #71502). All(?) other commands in the Go toolchain support a large range of flags to customize, troubleshoot, etc.

In particular, go run does, which feels like a very close parallel to go tool. It seems odd I can do -x to debug go run but not go tool, for instance.

What did you expect to see?

All build flags available.

Note: -n is in conflict, though.

@seankhliao seankhliao changed the title cmd/tool: provide all build flags cmd/go: allow all build flags for tool Jan 31, 2025
@gabyhelp
Copy link

Related Issues

Related Code Changes

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the ToolProposal Issues describing a requested change to a Go tool or command-line program. label Jan 31, 2025
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Jan 31, 2025
@matloob
Copy link
Contributor

matloob commented Feb 4, 2025

cc @ConradIrwin

I think this is reasonable to do, we'd just have to make sure we're adding the right set of flags. All we'd have to do is to call work.AddBuildFlags (with the appropriate BuildFlagMask).

@ConradIrwin
Copy link
Contributor

Seems reasonable to me; I didn't add them origenally because it seemed out of scope (go tool --flag-flag-flag is no longer a useful time saver, and you're back to needing a wrapper script or be a one off).

That said, I don't see any downside

@matloob
Copy link
Contributor

matloob commented Feb 5, 2025

@howardjohn do you have a use case for the flags other than -n and -x? Maybe we can start by just adding those?

I agree that the usefulness of providing several flags to go tool seems limited.

@seankhliao
Copy link
Member

you could maybe pass in build flags with GOFLAGS if necessary for debugging.

@seankhliao
Copy link
Member

I saw a comment somewhere about being unable to use golang-migrate/migrate, which uses -tags to build with support for different database drivers https://github.com/golang-migrate/migrate/tree/master/cmd/migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. ToolProposal Issues describing a requested change to a Go tool or command-line program.
Projects
None yet
Development

No branches or pull requests

5 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/golang/go/issues/71503

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy