-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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 doc -h is inconsistent and slightly broken #55985
Comments
Doesn't seem like much of a problem to me. The output is helpful, arguably more so than the others'. I wouldn't call it "broken". Is vet problematic for you too? Because it's also different, and harmlessly so. |
At a minimum, the I wouldn't mind if |
I was just stumped at Here's a small repro, using https://github.com/mvdan/sh/tree/master/interp as a sample Go package inside a third party module with some imports:
In this particular case, the wait was about a third of a second, because the package and its dependencies are smaller - |
I'm not sure which way is best, but thought I'd share my experience. I hadn't noticed the One alternative option would be to grab some documentation (perhaps just the Consistency between tools would be nice, but I'd lean towards making the others at least print their basic usage, rather than just essentially remove |
That looks to be because For the wider issue of initial |
In general,
go command -h
is very short at just a few lines, pointing instead togo help command
for the longer help text. However,go doc -h
is an outlier.Note that
go doc -h
prints many more lines than the others, but also, it prints anexit status 2
line which seems wrong. The latter seems to be because it combinesCustomFlags: true
with executinggo tool doc -h
, which means that the flag parsing happens in the child process, and the parent process simply shows the non-zero exit status.We probably should:
go doc -h
to show a few lines like the others, for consistencygo doc
to never showexit status 2
for flag errors likego doc -h
orgo doc -badflag
Also note that
go tool doc -h
is slightly confusing; unlike others such asgo tool fix -h
, it shows the help forgo doc
rather thango tool doc
.cc @robpike @bcmills @matloob
The text was updated successfully, but these errors were encountered: