Join GitHub today
x/tools/cmd/godoc: support linked examples #11397
Reviewing this CL I saw a cute thing done with related examples. In short:
It might be helpful for godoc to recognize this and show the user that the latter examples continue from the first one. I'm not sure exactly how that might look, but it's something to think about.
I think the "dependency" should only be revealed when the example is revealed. Currently non-runnable examples just show "Code:" and then the block of code within the examples. Dependencies (there could be more than one) could be shown just above "Code:":
To determine what the dependencies are we would have to choose between the user including some metadata (eg via comment) or by parsing the code.
Also it's not clear to me whether the current go official convention is to condone examples (even non-runnable ones) to
@agnivade ccing you since you've worked on godoc UI recently. (I assume you might not have seen this in the backlog due to its age or because the title uses "go/doc" instead of the more recent x/tools/cmd/godoc. Perhaps we should change the title to make this more easily searchable.)
Neither do I. I can't see how this "linking" is going to be helpful, whatever that's supposed to look like. It's fine to use an
changed the title from
go/doc: support linked examples
x/tools/cmd/godoc: support linked examples
May 26, 2018
Looks like it's actually against go vet (probably
I don't know if this means we should close this issue, but if we want to keep it open go vet -test would need to be relaxed.