Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upx/tools/cmd/godoc: remove CLI support in Go 1.12 #25443
Comments
gopherbot
added this to the Proposal milestone
May 17, 2018
gopherbot
added
the
Proposal
label
May 17, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
May 17, 2018
Member
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.
|
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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
May 17, 2018
Member
@ianthehat mentioned that many IDEs invoke the godoc binary from releases to get documentation. Which ones? Can we convert them to use "go doc"?
|
@ianthehat mentioned that many IDEs invoke the godoc binary from releases to get documentation. Which ones? Can we convert them to use "go doc"? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
May 17, 2018
Member
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?
|
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? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
As one such example - #16183 needs a fix to both |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rsc
May 21, 2018
Contributor
@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.
|
@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. |
mpx
referenced this issue
May 27, 2018
Open
cmd/doc: support output of full documentation for a package or identifier #25595
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mpx
May 27, 2018
Contributor
A single CLI documentation tool would be good.
godoc has some useful functionality that isn't present in go doc. Eg, output of full package documentation (#25595). I'd be in favour of adding this to go doc as an option.
Another example might be HTML output from godoc. This probably isn't a good fit for go doc. Maybe godoc could continue to have a cut-down mode that only outputs full package doc in HTML? I don't have any strong opinions here (I don't use it), but others might.
|
A single CLI documentation tool would be good.
Another example might be HTML output from |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
Jul 16, 2018
Member
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 godoc (no space). In Go 1.12, users (and any IDEs?) will need to use go doc for the CLI mode.
|
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 |
bradfitz
added
the
Proposal-Accepted
label
Jul 16, 2018
bradfitz
modified the milestones:
Proposal,
Go1.11
Jul 16, 2018
bradfitz
changed the title from
proposal: x/tools/cmd/godoc: remove CLI support?
to
x/tools/cmd/godoc: remove CLI support in Go 1.12
Jul 16, 2018
bradfitz
self-assigned this
Jul 16, 2018
bradfitz
added
Documentation
NeedsFix
labels
Jul 16, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gopherbot
Jul 31, 2018
Change https://golang.org/cl/126737 mentions this issue: doc/go1.11: add note to remove CLI support for godoc
gopherbot
commented
Jul 31, 2018
|
Change https://golang.org/cl/126737 mentions this issue: |
bradfitz
removed
the
Documentation
label
Jul 31, 2018
bradfitz
modified the milestones:
Go1.11,
Go1.12
Jul 31, 2018
pushed a commit
that referenced
this issue
Jul 31, 2018
added a commit
to jeet-parekh/go
that referenced
this issue
Jul 31, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gopherbot
Oct 11, 2018
Change https://golang.org/cl/141397 mentions this issue: godoc, cmd/godoc: remove CLI support
gopherbot
commented
Oct 11, 2018
|
Change https://golang.org/cl/141397 mentions this issue: |
gopherbot
closed this
in
golang/tools@e5fe289
Oct 11, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adg
Oct 11, 2018
Contributor
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.
|
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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
Oct 11, 2018
Member
@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.
|
@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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Sounds good. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
myitcv
Oct 11, 2018
Member
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 godoc. On the last golang-tools call, @ramya-rao-a mentioned that VSCode currently uses godoc by default, with the option of gogetdoc (which is what I think we see here).
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 godoc is installed from x/tools, does this not break things pre Go 1.12?
|
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 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
agnivade
Oct 11, 2018
Member
I think one should use the godoc which is packaged as a part of the 1.11 distribution. If you compile godoc from HEAD, it has to break some time or other.
The release notes are correct assuming one uses godoc from the distribution. Not if someone builds from master.
|
I think one should use the The release notes are correct assuming one uses |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
What @agnivade said. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
myitcv
Oct 11, 2018
Member
@agnivade @bradfitz - that makes sense.
Will just wait for @ramya-rao-a to confirm which godoc VSCode is currently using.
|
@agnivade @bradfitz - that makes sense. Will just wait for @ramya-rao-a to confirm which |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Oct 11, 2018
@myitcv is right. godoc cli is used in VS Code. We install it using go get golang.org/x/tools/cmd/godoc
I would be ok to move to using go doc instead.
ramya-rao-a
commented
Oct 11, 2018
•
|
@myitcv is right. I would be ok to move to using |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
myitcv
Oct 11, 2018
Member
@ramya-rao-a per #25443 (comment) you could also use godoc found at $GOROOT/bin/godoc.
The more immediate question: is vscode-go's "default" install currently broken because golang.org/x/tools/cmd/godoc has lost its CLI powers?
|
@ramya-rao-a per #25443 (comment) you could also use The more immediate question: is |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Oct 11, 2018
Pardon my ignorance, I have some basic questions...
I think one should use the godoc which is packaged as a part of the 1.11 distribution. If you compile godoc from HEAD, it has to break some time or other
- Was
godocalways packaged as part of the Go distribution (and so available at GOROOT/bin)? If I were to remove the "get godoc from golang.org/x/tools/cmd/godoc" step in VS Code, and rely onGOROOT/bin/godocbinary, would this work for all previous versions of Go? - Is there any difference between the
godocpackaged as part of the Go distribution and the one compiled fromgolang.org/x/tools/cmd/godocapart from the fact that the latter will be using the HEAD? - If I understand this correctly, from Go 1.12 onwards,
godocwill no longer be packaged as part of the Go distribution and editors should usego docinstead?
ramya-rao-a
commented
Oct 11, 2018
|
Pardon my ignorance, I have some basic questions...
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bradfitz
Oct 11, 2018
Member
Was godoc always packaged as part of the Go distribution (and so available at GOROOT/bin)? If I were to remove the "get godoc from golang.org/x/tools/cmd/godoc" step in VS Code, and rely on GOROOT/bin/godoc binary, would this work for all previous versions of Go?
Yes.
Is there any difference between the godoc packaged as part of the Go distribution and the one compiled from golang.org/x/tools/cmd/godoc
Nope.
If I understand this correctly, from Go 1.12 onwards, godoc will no longer be packaged as part of the Go distribution and editors should use go doc instead?
I'm not sure that's been decided, but it's likely. But if we do ship godoc, it won't have CLI mode, and it might even be named something else.
Yes.
Nope.
I'm not sure that's been decided, but it's likely. But if we do ship godoc, it won't have CLI mode, and it might even be named something else. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Oct 11, 2018
Thanks @bradfitz In that case, I can make the change to remove the dependency on golang.org/x/tools/cmd/godoc for the next version of the Go plugin in VS Code and fallback on the GOROOT/bin/godoc. And in the long run, I can look into using go doc instead.
The more immediate question: is vscode-go's "default" install currently broken because golang.org/x/tools/cmd/godoc has lost its CLI powers
I just tried go get golang.org/x/tools/cmd/godoc and the CLI mode works just fine. Is there a timeline when we can expect the godoc generated from running go get golang.org/x/tools/cmd/godoc to stop having the CLI mode?
ramya-rao-a
commented
Oct 11, 2018
•
|
Thanks @bradfitz In that case, I can make the change to remove the dependency on
I just tried |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
myitcv
Oct 11, 2018
Member
@ramya-rao-a - per our Slack conversation, I suspect that worked because you already have golang.org/x/tools/cmd/godoc checked out in your GOPATH. The changes to remove the CLI support are already merged, hence a fresh install (or after a go get -u golang.org/x/tools/cmd/godoc):
export GOPATH=$(mktemp -d)
cd $GOPATH
go get golang.org/x/tools/cmd/godoc
$GOPATH/bin/godoc strings
gives:
Unexpected arguments.
usage: godoc -http=localhost:6060
-analysis string
comma-separated list of analyses to perform (supported: type, pointer). See http://golang.org/lib/godoc/analysis/help.html
...
with a non-zero exit code.
|
@ramya-rao-a - per our Slack conversation, I suspect that worked because you already have
gives:
with a non-zero exit code. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Oct 11, 2018
In that case, anybody setting up VS Code from scratch will not get the documentation on hover feature until I release an update. That should be fine.
ramya-rao-a
commented
Oct 11, 2018
|
In that case, anybody setting up VS Code from scratch will not get the documentation on hover feature until I release an update. That should be fine. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gopherbot
Oct 11, 2018
Change https://golang.org/cl/141717 mentions this issue: cmd/godoc: synchronously init corpus for index mode
gopherbot
commented
Oct 11, 2018
|
Change https://golang.org/cl/141717 mentions this issue: |
bradfitz commentedMay 17, 2018
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