-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: cmd/go: forward to custom commands #48411
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
Comments
It already does something close to this: That's what the "go tool" command does. It just looks in a special directory (pkg/tool/$GOARCH/) for the binary. I just verified this by copying
If you put gomobile into that directory as 'mobile', then you could run So maybe what's needed is more policy around the tool directory. |
That sounds great but does not entirely address the key of the proposal. The key is that we could drop the go prefix using go command. Assume we updated the The existing |
The We could easily change |
That is a good argument, it still looks great if we change the proposal to: allow Does this change makes the proposal more consistent with the existing approach in |
That's the opposite of what I am suggesting. I am suggesting that we allow things to be added to the tool directory, not that |
Adding a command to the tool directory is a Go-specific change and does not empower any few coming commands, it seems too limited. Every time if we'd like to use a new command, it has to send as a proposal. Hence it does not really allow the community-developed tools to customize the usage of the |
Works just fine with any command you can find. |
I don't see what the advantages of putting third party commands under the |
A few benefits:
|
I could see value in this if it meant that running programs via the For example, perhaps For another example, on my system where I use I feel much less convinced if the idea is just to make Unrelatedly, I'd note that putting the extensibility at the top level (directly after |
It's an anti-goal to make the go command itself extensible in the way that git is. |
You said "closing" but didn't close it. I'll close it. |
This proposal has been declined as infeasible. |
Like custom git commands
git-codereview
can be used viagit codereview
.I propose the
go
command to support custom commands too. This could allow users to write customized commands which can also be used through thego
command. Specifically, the proposal is: letgo mycommand
forward its arguments and invokegomycommand
orgo-mycommand
, ifgomycommand
orgo-mycommand
exists in PATH.In a today's example,
go mobile
will forward and invoke the commandgomobile
.The text was updated successfully, but these errors were encountered: