Skip to content
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

proposal: x/tools/godoc: add flag to ignore comments beginning with ... #20925

Closed
jons opened this issue Jul 6, 2017 · 3 comments
Closed

proposal: x/tools/godoc: add flag to ignore comments beginning with ... #20925

jons opened this issue Jul 6, 2017 · 3 comments

Comments

@jons
Copy link

jons commented Jul 6, 2017

i would like to be able to use godoc and swagger simultaneously on a single API (built with the beego framework) in order to provide two sets of documentation, intended for different audiences.

to achieve this, all that is necessary is to tell godoc to ignore comment lines where the first non-whitespace token begins with "@" (swagger already ignores the untagged, godoc-friendly comments). currently, godoc will instead dump these into its output as though they were natural sentences in a paragraph.

@gopherbot gopherbot added this to the Proposal milestone Jul 6, 2017
@bradfitz
Copy link
Contributor

bradfitz commented Jul 6, 2017

You may want to expand your proposal to add more details for those not familiar with either Beego or Swagger. (Is Beego relevant to this proposal?).

But in the past, all proposals around adding @MagicAnnotations or other special comments to godoc have been rejected. I don't see how this one would be different.

@groob
Copy link
Contributor

groob commented Jul 6, 2017

I have successfully used @adams-sarah's project https://github.com/adams-sarah/test2doc in the past. It uses the Apiary format rather than Swagger, but you could extend it to swagger with some engineering effort.

The nice thing is that it does not require creating comments in godoc. The documentation is generated based on your http handler tests.

If you wanted to, you could write the Example format tests to work with test2doc so they'd show up both as godoc examples and as REST API documentation.

@rsc
Copy link
Contributor

rsc commented Jul 17, 2017

As Brad said, we aren't going to change the godoc comment format to hide various lines. @groob's comment about test2doc sounds like a better solution.

@rsc rsc closed this as completed Jul 17, 2017
@golang golang locked and limited conversation to collaborators Jul 17, 2018
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

5 participants