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: actually allow "go run" without any arguments nor flags #36235

Open
mvdan opened this issue Dec 20, 2019 · 0 comments
Open

proposal: cmd/go: actually allow "go run" without any arguments nor flags #36235

mvdan opened this issue Dec 20, 2019 · 0 comments
Labels
Milestone

Comments

@mvdan
Copy link
Member

@mvdan mvdan commented Dec 20, 2019

#22726 was accepted and implemented a while ago. I'm really happy with it, because go run . is pretty useful.

I also understand the point that @rsc brought up about ambiguous flags. Not accepting go run -foo is reasonable, instead forcing the user to write go run -foo . or go run . -foo to clarify if the flag is for the Go tool or for the main package.

However, I don't quite undrestand why go run without any flags or arguments was left out:

$ go run
go run: no go files listed

The only reason I can think of is consistency, to make go run always require file or package arguments. Still, I'd argue that this form alone should be allowed. It's pretty convenient, and we could simply point the user in the right direction if they try to add a flag alone:

$ go run -foo
go run: specify a package or list of Go files to use flags

This would also actually mark the original proposal as implemented. I was pretty confused that the original proposal was accepted and closed, while the very idea in the title was never implemented.

At the very least, if this proposal is rejected, I think the original proposal should be retitled.

/cc @myitcv @rogpeppe @broady @rsc

@gopherbot gopherbot added this to the Proposal milestone Dec 20, 2019
@gopherbot gopherbot added the Proposal label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.