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: make test -list prints everything when passed no regex #20612

Closed
ALTree opened this issue Jun 8, 2017 · 8 comments
Closed

cmd/go: make test -list prints everything when passed no regex #20612

ALTree opened this issue Jun 8, 2017 · 8 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jun 8, 2017

CL 41195 added a new -list flag to go test that can be used to list all the Tests, Benchmarks and Examples without running them. It takes a regex argument:

-list regexp
    List tests, benchmarks, or examples matching the regular expression.

but the default behaviour when passed no arguments it's unhelpful and frustrating: it says

$ gotip test -list
go test: missing argument for flag list

and exits.

It would be nice if go test -list could, when passed no regex, just print everything without forcing me to type gotip test -list .

@cznic
Copy link
Contributor

cznic commented Jun 8, 2017

How to define 'no regex'? What is 'foo' in go test -list foo? An Import path or a regexp?

@ALTree
Copy link
Member Author

ALTree commented Jun 8, 2017 via email

@mvdan
Copy link
Member

mvdan commented Jun 8, 2017

I'm concerned about consistency, in particular how this would confuse people using go test -list alone. For example, -bench requires you to use a silly regex like . if you want to run all benchmarks. And I'd say go test -bench=. is way more common than go test -list=..

@ALTree
Copy link
Member Author

ALTree commented Jun 8, 2017 via email

@mvdan
Copy link
Member

mvdan commented Jun 8, 2017

Perhaps keep it open in case ayone agrees with the general idea. If there's a time to change how -test works, it's definitely before 1.9 is released.

@bradfitz
Copy link
Contributor

bradfitz commented Jun 8, 2017

How about we think about this for Go 1.10? If we wanted to add this support, we can add it later, and we can also modify -bench to act like -bench=. at the same time if it's decided to add bare -list.

@bradfitz bradfitz added this to the Go1.10 milestone Jun 8, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 8, 2017
@ALTree
Copy link
Member Author

ALTree commented Jun 8, 2017

Sounds good. I would love to get rid of the -bench=. curse.

@rsc
Copy link
Contributor

rsc commented Jun 12, 2017

No. Currently go test -bench . strings means to run all the benchmarks in the strings package. Redefining as suggested would change it to mean all the benchmarks in the current directory (dot) and the strings package. That's not something we can change at this point. The same is true of list.

@rsc rsc closed this as completed Jun 12, 2017
@golang golang locked and limited conversation to collaborators Jun 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants