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: go test [-h | -? | -help] shows output for go help #6576

Closed
ugorji opened this issue Oct 13, 2013 · 10 comments
Closed

cmd/go: go test [-h | -? | -help] shows output for go help #6576

ugorji opened this issue Oct 13, 2013 · 10 comments
Milestone

Comments

@ugorji
Copy link
Contributor

ugorji commented Oct 13, 2013

When I run go test -h (or -help or -?) on the command line, 
I expect to see the full list of arguments that the generated pkg.test
expects.

However, I instead see the output of go help.

I have to pass some arguments unknown to go command and to my test flags
to see the output. For example, if I run
    go test -randomstring
    go test -abcdef

Then I see the command line flags that my test accepts.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which version are you using?  (run 'go version')
go version devel +47b2b07a837f Fri Oct 11 16:39:40 2013 -0700 linux/amd64

Please provide any additional information below.
@minux
Copy link
Member

minux commented Oct 13, 2013

Comment 1:

in general, the go tool can't show the flags that the test binary accepts without
actually running it.
so you can do this:
go test -c mypkg
./mypkg.test -h
imho, `go test -h` should display the output of `go help testflag`.

@ugorji
Copy link
Contributor Author

ugorji commented Oct 13, 2013

Comment 2:

@minux
That's fine. 
I would think users would expect either the result of "go help testflag" or a listing of
all the flags that the test execution expects (which go test -abcdefg gives). The
current output is the result of running "go help" or "go -h", etc.
It's nice for folks running tests to see the flags that the current test execution
expects, in the most intuitive way. Sample output:
go test [-h | -? | help]
Usage of /home/all/tmp/go-build595553679/ugorji.net/codec/_test/codec.test:
  -bd=1: Bench Depth: If >1, potential unreliable results due to stack growth
  -tdbg=false: Test Debug
  -test.bench="": regular expression to select benchmarks to run
...
For more detailed information on the standard test flags, run "go help testflag".

@adg
Copy link
Contributor

adg commented Oct 14, 2013

Comment 3:

I agree with minux here. But we'll do this after Go 1.2

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@ugorji
Copy link
Contributor Author

ugorji commented Oct 14, 2013

Comment 4:

On further thought, I agree too that 
  go test [-h | -? | -help] 
should output result of 
  "go help testflag". 
This is consistent with other go XXX commands.
Having said that, it will be nice to have a standard command recognized by 
"go test" that will show the flags that the current test execution takes. 
Right now, the workaround is to pass a non recognized flag.

@minux
Copy link
Member

minux commented Oct 14, 2013

Comment 5:

a hacky solution:
https://golang.org/cl/14502065

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@minux
Copy link
Member

minux commented Dec 18, 2013

Comment 9:

This issue was closed by revision 8606b97.

Status changed to Fixed.

@gopherbot
Copy link

CL https://golang.org/cl/12173 mentions this issue.

rsc added a commit that referenced this issue Jul 15, 2015
Originally 'go test -h' printed the output of 'go help test'.
Then issue #6576 was filed, because that output didn't list (for example) -bench.
CL 14502065 changed 'go test -h' to print the output of 'go help testflag'.
Then issue #9209 was filed, because that output didn't list (for example) -c.

To print all the relevant flags, parts of both 'go help test' and 'go help testflag'
are needed. Refactor the help messages to make those parts available
and print them.

Fixes #9209.

Change-Id: Ie8205b8fb37d00c10d25b3fc98f14286ec46c4e3
Reviewed-on: https://go-review.googlesource.com/12173
Reviewed-by: Rob Pike <r@golang.org>
@mikioh mikioh added this to the Go1.5 milestone Jul 16, 2015
@golang golang locked and limited conversation to collaborators Jul 18, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants