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: does not show methods with receivers #18525
Comments
This might be intentional. @robpike? |
go doc doesn't also show much from interfaces or struct types, e.g. no struct fields are listed. I assume we need to do better in representing them if we list methods for consistency. |
@rakyll |
I believe this is intentional.
|
|
What is the purpose of "go doc" vs "godoc"? (Pardon my ignorance as I have no historical context.) Because "godoc" is very verbose and shows everything. Perhaps there can be a "go doc -detailed"? I am using "go doc" to diff two versions of a package in terms of API changes except the documentation (added methods/types etc). "Godoc" doesn't provide this type of output but "go doc" does, although it is incomplete. |
It's intentional. The usual word for "methods with no receivers" in this context is "constructor". Go doc shows the top-level vars, consts, funcs, and types, and constructors for those types. If it printed the docs for every method of every type in the package it would be unusably verbose for many packages. |
What version of Go are you using (
go version
)?go1.7
What did you do?
I ran
go doc io
.What did you expect to see?
I expected to see methods
members of
io.Pipewriter
in the output, because I see them ingodoc io
(mind the difference):What did you see instead?
I did not see these functions with receivers (=methods) in the
go doc
output.go doc
cmd does not show methods. It only shows functions with no receivers.However, if I do
go doc io.PipeWriter
I see its methods. But I thinkgo doc pkg
should be able to lay out all exported API surface of a package (unless it's a deliberate design choice, of course).The text was updated successfully, but these errors were encountered: