-
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: remove CLI support in Go 1.12 #25443
Comments
As background, this is motivated by the Go team maintaining something like 5 variations of "godoc" tools at the moment, and there's too much duplication and maintenance effort. |
@ianthehat mentioned that many IDEs invoke the godoc binary from releases to get documentation. Which ones? Can we convert them to use "go doc"? |
Or for such IDEs, it was proposed that we could perhaps make the "godoc" binary detect when it's in "legacy CLI mode" and invoke the "go doc" command as a subcommand instead? |
As one such example - #16183 needs a fix to both |
@ianthehat, the IDE issue just means we have to coordinate this over multiple releases if we do it. If we decide to do it, then we can work on making it smooth. Personally I'm +1 on simplifying so that "godoc" is always just the package web server and not also the main web site nor a command-line doc viewer. It also might be better to just drop the name "godoc" entirely, to avoid confusion with "go doc" and also godoc.org. The web server could be godochttp/godocsrv/godocweb/etc. |
A single CLI documentation tool would be good.
Another example might be HTML output from |
Decision: we'll document in the Go 1.11 release notes that the Go 1.11 release will be the last to support CLI mode |
Change https://golang.org/cl/126737 mentions this issue: |
Updates #25443 Change-Id: I5e2f84f3cee6582807b2756ffac91e8583a2baec Reviewed-on: https://go-review.googlesource.com/126737 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Updates golang#25443 Change-Id: I5e2f84f3cee6582807b2756ffac91e8583a2baec Reviewed-on: https://go-review.googlesource.com/126737 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Change https://golang.org/cl/141397 mentions this issue: |
What about @rsc's suggestion that we rename the godoc command to something else? I'm on the fence. I guess we could see if anyone gets confused first. |
@adg, I'm fine renaming it (assuming we find a good name) but I didn't want to do it in that CL. I'd also rather push that decision out until the website rearchitecting plan is more solidified. I haven't heard the latest plan there in some time. |
Sounds good. |
Picking up on discussion with @adg in the CL. I think this change being merged now will create a problem, per @ianthehat's comments, for VSCode (at least) which has a default of I read https://golang.org/doc/go1.11#godoc as "godoc as a CLI will be around, but deprecated, for Go 1.11, and then not available in Go 1.12". Given |
Change https://golang.org/cl/145222 mentions this issue: |
Effective Go and the FAQ still had some instances which showed the command line usage of godoc. Changed them to use go doc. Updates #25443 Change-Id: If550963322034e6848bc466f79e968e7220e4a88 Reviewed-on: https://go-review.googlesource.com/c/145222 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* Add item documentation to completions Using `go doc` instead of `godoc` due to golang/go#25443 `go doc` doesn't seem to support giving the code of an unsaved file via stdin like `gocode`, so it won't display documentation for unsaved changes. Fixes #194 * Code review fixes for #2054 * Refactoring and comments * Always resolve the item * Prompt for updating gocode if the package property is missing
Change https://golang.org/cl/162982 mentions this issue: |
Change https://golang.org/cl/162984 mentions this issue: |
The documentation of the "flat" presentation mode was removed inadvertently as part of post-CLI-removal documentation cleanup in CL 143077. The FlatDir flag still exists and is supported. This change re-adds it to cmd/godoc documentation. Also fix a typo in the "src" presentation mode description. Updates golang/go#25443 Change-Id: If4705d70bc5eafee92cdfd52409aca4606a0efd7 Reviewed-on: https://go-review.googlesource.com/c/162984 Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a followup to CL 141397, which removed CLI support from the godoc command for golang/go#25443. This change removes a few more CLI-related fields from Presentation type, which are now unused. It also removes the unused and no longer documented (since CL 143077) NoHTML PageInfoMode. Updates golang/go#25443 Change-Id: Ia4147515052889570e2f050e3c2394689d3c5d6c Reviewed-on: https://go-review.googlesource.com/c/162982 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Is there any way to generate HTML documentation like we could do with Currently resorting to this workaround |
@leucos You should be able to continue to use the
|
Great, thanks @dmitshur , works like a charm. Sorry for the noise on a closed topic. |
@dmitshur Any suggestions as to how to do that when working with a local go module based development? I got |
Change https://golang.org/cl/172975 mentions this issue: |
Change https://golang.org/cl/177737 mentions this issue: |
At least inside this one package. It's because golang.org/x/tools/cmd/godoc no longer has CLI support as of golang/go#25443, it is now only a web server. Luckily, browsers that display HTML pages are not constrained to the fixed width of punched cards. On the contrary, they seem to embrace a wide variety of arbitrary page widths, ranging from narrow to wide. This is in part due to the proliferation of internet access on device form factors such as the mobile phone, tablet, laptop, and desktop. So the punchCardWidth constant is now unused and can be removed. This is a followup to CL 141397 that removed most of the CLI support code, including the function comment_textFunc, which was its only user. Same goes for containsOnlySpace. Updates golang/go#25443 Change-Id: I61fabe6ea801c88758fb2c6aefa70b53d52e2cb5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/172975 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The original CL 84050044 added a test case, and it happened to be in between various CLI test cases. CLI support was removed from x/tools/cmd/godoc in CL 141397, as part of golang/go#25443. Re-add a test case for this behavior to prevent regressions. Updates golang/go#32092 Updates golang/go#25443 Updates golang/go#5247 Change-Id: I0cea74cfe40d120e398a9005676134c5bad6136c Reviewed-on: https://go-review.googlesource.com/c/tools/+/177737 Reviewed-by: Robert Griesemer <gri@golang.org>
Before v1.12, I can use Otherwise where is the Go claimed backward compatibility? |
The Go compatibility promise excludes tools: https://golang.org/doc/go1compat#tools |
@bradfitz thanks for your reply and clarifying of it. I misunderstood it. But I still hope there's a such |
@gingerhot Have you considered the |
@dmitshur Thank you for response. I've read your solution above, it's awesome for those packages within the GOPATH, I need do some tricks to make it work for those packages outside the GOPATH in my situation. Such as put the code under a |
Change https://golang.org/cl/197721 mentions this issue: |
The documentation of the "flat" presentation mode was removed inadvertently as part of post-CLI-removal documentation cleanup in CL 143077. The FlatDir flag still exists and is supported. This change re-adds it to cmd/golangorg documentation. Also fix a typo in the "src" presentation mode description. (This is a re-apply of CL 162984 into x/website.) Updates golang/go#25443 Updates golang/go#29206 Change-Id: I84145bf38f008678a8d8f3d3346f646aa7811886 Reviewed-on: https://go-review.googlesource.com/c/website/+/197721 Reviewed-by: Andrew Bonventre <andybons@golang.org>
godoc is now just a webserver (the one that runs golang.org) A future change might rename this to something else, but not now. Fixes golang/go#25443 Change-Id: Ib95d0589e13f4c7a717ff28d694f1472e427eef4 Reviewed-on: https://go-review.googlesource.com/c/141397 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
Now that we have the cmd/go "go doc" CLI for getting documentation, does it make sense for x/tools/cmd/godoc to also have CLI support?
I propose we delete x/tools/cmd/godoc's CLI support and keep it being a web-only tool. Users who want CLI support can use "go doc". Both are shipped with Go releases.
/cc @dsnet @andybons @stamblerre @shantuo @robpike
The text was updated successfully, but these errors were encountered: