-
Notifications
You must be signed in to change notification settings - Fork 18k
x/website: enable godoc analysis mode #11251
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
Comments
Have you tried 'godoc -http :6060 -analysis type'?
|
I think this bug is about having godoc's analysis mode enabled by default for golang.org Related: #8968 /cc @alandonovan @adg |
Thanks! I missed "-analysis type" indeed. This does exactly what I asked for. And yes, it would be great to have it enabled on golang.org and godoc.org. |
Enabling it for golang.org is probably ok (it might also need an increase
of the App Engine memory limit), but not for godoc.org (imagine how
many outputs it will provide for commonly implemented interfaces like
io.Reader or error; not to mention that the analysis must redo each time
any package changes)
|
Right, I mentioned this in the first post. It's a presentation issue, and I'm pretty sure it can be solved somehow. 1. Show "too many" if there are many implementers, possibly a href leading to a separate URL with full list. 2. Show some packages (most popular?) and ellipsis in the end. 3. Paginate the list. 4. Anything more smart. |
/cc @adg for enabling -type analysis on golang.org.
For godoc.org, it might need some more work
(I think we need to make the analysis incremental
and not requiring loading all the packages into
memory.)
|
ping @adg |
@andybons would be the owner of this now. |
(It seems worth doing, unless we run into performance problems on start-up or ridiculous memory usage. If either of those occur, punt to a later release or Unreleased.) |
I just tried it. Few oddities:
|
Retargetting to Go 1.12. /cc @dmitshur |
According to this comment, it is creating a testmain package. I can see it found out some types that implements interfaces coming from test packages.
That is easy.
One reason might be it also displays private methods. So it cannot link to package docs since private methods are not shown. We should probably fix this to match with Some closing thoughts -
So as I see - the only 2 new sections added by analysis mode are "implements" and "method-set". And we already have some open issues that try to incorporate some of that into main godoc. We might need to give some thoughts on whether to polish the analysis mode and make it the default, thereby resolving the other open issues. Or do we slowly bring the features of analysis mode by fixing the open issues one by one. (Does that mean "analysis" mode will become redundant ?) /cc @alandonovan , @griesemer btw, running analysis mode takes a ridiculous amount of memory if we run it on GOPATH. Just GOROOT is fine. I had to kill the process after it consumed my entire RAM (16GB). |
Regarding performance, I think it'd be fine if it only performed analysis within a single package for implemented by. Doesn't need to be across the entire $GOPATH. Implements is I think the current package plus $GOROOT would be fine for now. |
That should happen when godoc supports module mode. @dmitshur is working on that. |
Analysis support was dropped from godoc in CL 358954. |
It would be useful to annotate interfaces in the godoc with list of known implementers.
Use case: I want to use text/scanner package and parse some data I receive from network. While reading its documentation I encounter a reference to io.Reader: https://golang.org/pkg/text/scanner/#Scanner.Init. I click on "io.Reader", and it would be nice to know that besides of net.TCPConn this interface is also implemented by bufio.NewReader, which can be used in my case.
Caveat: number of types implementing trivial interfaces can be huge.
The text was updated successfully, but these errors were encountered: