Skip to content

godoc should compute actual method set #1000

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

Closed
rsc opened this issue Aug 5, 2010 · 6 comments
Closed

godoc should compute actual method set #1000

rsc opened this issue Aug 5, 2010 · 6 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Aug 5, 2010

type foo struct { }

// Doc comment
func (f *foo) Method()

type T struct {
    foo
}

It would be nice if godoc showed Method as a method of T.

There is code in package net that could be simplified by
using embedded types, but it is not, because doing so would
lose method documentation.
@griesemer
Copy link
Contributor

Comment 1:

Doing this reasonably correctly will require a significant rewrite of the current
documentation extraction mechanism: Non-exported AST nodes are stripped via
ast.PackageExports (or ast.FileExports), at which point non-exported anonymous fields
are not present anymore even if they have exported methods and are used inside exported
structs. Thus, at this point, the go.doc code cannot associate exported methods of
non-exported anonymous fields with the exported type containing those fields. At best,
we can do it for exported anonymous fields, and even then, the field types must be
defined locally (in the same package).
A 100% correct solution will require full type information.

@rsc
Copy link
Contributor Author

rsc commented Jan 19, 2011

Comment 2:

We don't need a 100% correct solution, but it would be
very helpful to handle the case of an embedded unexported field.
Even if it means special handling for that one case, not
being able to get docs for those methods is complicating
some code that would otherwise be simpler (package net
comes to mind), all just to get doc comments.

@rsc
Copy link
Contributor Author

rsc commented Dec 9, 2011

Comment 3:

Labels changed: added priority-later.

@rsc
Copy link
Contributor Author

rsc commented Dec 12, 2011

Comment 4:

Labels changed: added priority-go1.

@griesemer
Copy link
Contributor

Comment 5:

This issue was closed by revision 9535b86.

Status changed to Fixed.

@rsc
Copy link
Contributor Author

rsc commented Jan 13, 2012

Comment 6:

Yay!

@rsc rsc added fixed labels Jan 13, 2012
@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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

3 participants