-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/cmd/godoc: hide deprecated things by default #17056
Comments
I'm all for cleaning up the documentation, but I don't like doing so by blacklist. What if godoc sorted items marked Deprecated below everything else and collapsed Deprecated items by default? That would work with the (semi?) standard deprecation warnings for everyone without a special case for officially super-deprecated items. It wouldn't be totally hidden but it would be less messy, clearer that stuff is deprecated at a glance in general, and not too difficult for someone to look up deprecated docs if needed. Something like:
where the {Client,Server}Conn's full documentation is at the bottom of the page, similarly collapsed. |
What about we make godoc hide deprecated definition by default?
And like Google search suppresses similar results, it could add a
line at the bottom:
Several deprecated definitions have been suppressed, if you want,
use <a href="?m=includedeprecated">this link</a> to view them.
Or we can add a new foldable category "Deprecated" that is hidden
by default.
We already formalized a way to do proper deprecation, I think this
is the logical next step.
|
@minux, SGTM. Hiding all deprecated things works for me with a mode to include them. Or have them simply be JavaScript-hidden is fine too, similar to Examples. |
SGTM |
Good idea. Present the current docs by default, but still make legacy docs available to those who need them. |
👎 because the "zero results" is misleading, a quick search finds examples in the wild like https://github.com/samalba/skyproxy/blob/master/client/client.go and there's also cases where ClientConn is less painful than working around the net/http interfaces. Giving deprecated stuff a separate section is probably reasonable but hiding it is at the very least also misleading. |
+1 for telling people that there are N things hidden. If they choose to "show all", let's also mark the deprecated stuff with an icon and group them together at the bottom. What is the string that godoc will look for? Is it |
Hiding deprecated stuff doesn't mean removing them. I think we can use
JavaScript to hide them so that an explicit link
golang.org/pkg/net/http/httputil/#ClientConn will still show the docs
(without manually toggling the show deprecated stuff setting).
|
I have a minor concern with simply hiding deprecated items. If I'm reviewing some code that uses a deprecated feature that I'm unfamiliar with and then go to the godoc of the package, I'll be a little confused when cntrl-f doesn't show the deprecated feature in question. Remembering to show deprecated features is probably not my first thought. Is it possible for cntrl-f to search through (and show) javascript hidden elements? However, I strongly believe that we should display deprecated features differently somehow in godoc. Edit: Just a thought, maybe hide deprecated types, methods, and functions from the index? but still show them in package documentation? It's inconsistent, so I'm on the fence about this idea. |
It seems that #10909 settled on |
The plan:
The |
Just wondering. How do you plan on handling deprecated fields in structs (e.g., zip.FileHeader.CompressedSize)? |
We'll probably punt on it. I don't see an elegant way of dealing with it. On 26 October 2016 at 07:36, Joe Tsai [email protected] wrote:
|
Maybe just use strike out text on the struct fields? Apologies if this was already discussed or declined. |
+1 to strike through. There are already similar issues filed against godoc.org and golint by the way. |
Strike-through seems too aggressive or at least too unreadable. I'd do a JS expando before I did strike-through. |
As @adg pointed out, there seems to be no elegant way of handling deprecated fields in structs. I totally agree with using "JS expando" for all other elements. Strike-through is just a possible solution for struct fields. |
Change https://golang.org/cl/70110 mentions this issue: |
In #10909, it was decided that "Deprecated:" is a magic string for tools (e.g., #17056 for godoc) to detect deprecated identifiers. Use those convention instead of custom written prose. Change-Id: Ia514fc3c88fc502e86c6e3de361c435f4cb80b22 Reviewed-on: https://go-review.googlesource.com/70110 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Joe Tsai <[email protected]>
As part of my work on #18342, I'm close to a working prototype of this. I'm going to self-assign this |
@dmitshur is this on the roadmap for http://pkg.go.dev/ ? |
I think it should absolutely be considered. /cc @julieqiu |
+1 - filed a separate issue (#40850) |
Change https://golang.org/cl/315509 mentions this issue: |
Rewrite body.tmpl so that if a type is deprecated, its methods and functions are hidden along with the type itself. For golang/go#17056 Change-Id: I7ba11f0902414e25c6267747d1a68aa26751e95a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/315509 Trust: Jonathan Amsterdam <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Julie Qiu <[email protected]>
cmd/godoc is essentially in maintenance mode, so we can close this issue. |
Summary
https://golang.org/pkg/net/http/httputil/ has some garbage I'd like to hide. I'd like to hide everything about ClientConn and ServerConn
Background:
Before Go 1, we renamed the
http
package tonet/http
and in the process deleted some junk, and moved other junk tonet/http/httputil
, thinking that people might still need it. This was all pre-Go 1 when the APIs were changing daily, weekly, monthly. But we were trying to be nice anyway.Turns out nobody needed that junk, though, even then, and not today:
https://github.com/search?utf8=%E2%9C%93&q=httputil.ClientConn&ref=simplesearch
https://github.com/search?utf8=%E2%9C%93&q=httputil.NewClientConn&type=Repositories&ref=searchresults
https://github.com/search?utf8=%E2%9C%93&q=httputil.ServerConn&type=Repositories&ref=searchresults
https://github.com/search?utf8=%E2%9C%93&q=httputil.NewServerConn&type=Repositories&ref=searchresults
Zero results.
I updated the docs some time ago:
https://golang.org/pkg/net/http/httputil/#ClientConn
... says simply:
There are a couple good bits in there, though.
ReverseProxy
is very widely used, and theDump*
functions are often used in debugging.Plan
Let godoc have configuration on public symbols to treat as if they were private. And then use that configuration for godoc.org to hide that junk, without deleting them from the package, so we don't violate the Go 1 compatibility promise. Think of this as a very strong form of deprecation.
If users really want to see it, they can use https://golang.org/pkg/net/http/httputil/?m=all to see all the junk.
FAQ
But Brad, this is a very slippery slope. What will we hide next?
Good question. There might be more to hide.
But why?
Because httputil looks embarrassing, and it looking like a trash heap prevents us from non-embarrassingly adding anything else to it. Let's clean up the house before we invite guests over.
/cc @griesemer @adg @broady @quentinmit @minux @campoy
The text was updated successfully, but these errors were encountered: