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/doc: help does not seem to be accurate for the "two arguments" mode #49830
Comments
CC @mvdan via https://dev.golang.org/owners Maybe also @rsc? |
That's certainly right - the docs should be updated to no longer mention the godoc CLI, which has been removed for some time. Merging such a CL would be easy, if you're up for sending one.
Perhaps try looking at the git blame or log to see whether the code or docs were changed most recently. My guess is that the docs used to be true, but then the code was improved, and the docs weren't updated. But it could also be the other way around - that the code's behavior was never intentional and we should update it to match the docs. It would also be worth checking out the tests. If there are any tests that break when the code is changed to match the docs, then that's a pretty strong signal that it's the docs which are wrong. |
@mvdan it seems that the change was first introduced in e3442b4:
Actually, there is a test that tests this behavior: Lines 920 to 966 in 18934e1
I'll send a CL later updating the docs. |
Change https://golang.org/cl/367497 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, both in the latest stable and tip.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see? / What did you see instead?
go help doc
shows the following information regarding running "go doc" with two arguments:In
go doc template New
,template
is a suffix. However,go doc
shows documentation for html/template's New function. Which seems to be the same behavior of callinggo doc
with one argument (i.e.go doc template.New
). The documentation explicitly says "the first (argument) must be a full package path (not just a suffix)".It seems to me that the documentation is outdated. Also, if I'm not wrong, nowadays
godoc
does not accept that syntax anymore, as it only provides an http server mode.Extra information
findNextPackage
is called when go doc is run with two arguments:go/src/cmd/doc/main.go
Lines 214 to 229 in 0fa53e4
and:
go/src/cmd/doc/main.go
Lines 378 to 380 in 0fa53e4
The text was updated successfully, but these errors were encountered: