golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.19k stars 17.37k forks source link

x/pkgsite/internal/fetch/dochtml, x/tools/cmd/godoc: BUG, TODO etc. should be re-thought #5060

Open robpike opened 11 years ago

robpike commented 11 years ago
Godoc needs updated rules and a nice UI for interpreting and presenting BUG(foo),
TODO(bar) etc. The current setup is odd: it treats things internal to functions
specially, while things at top level are too loosely bound. For instance,

// Foo bars blatz.
// BUG(gopher): Foo should bing bang bam.
func Foo() { } 

will fold the TODO onto the previous line, while

// BUG(gopher): Foo should bing bang bam.

// Foo bars blatz.
func Foo() { } 

will print the BUG for every query of the package. This is far from intuitive or helpful.
adg commented 11 years ago

Comment 1:

Labels changed: added godoc.

gopherbot commented 11 years ago

Comment 2 by pedromorgan:

Yes its strange.. And godoc.org completely ignores them
griesemer commented 11 years ago

Comment 3:

At the moment, notes are collected from all comments in the source _but_ the comments
that are declaration documentation. That is, all comments that declare an exported item
stay with that item. So if that (group of) comments contains a TODO, BUG, etc. that part
of the comment is simply untouched and shown with the comment.
All otherwise discarded comments are then searched for notes, which are always shown
separately and collectively. There is no association with any specific entity. There is
no difference between notes inside function and notes on the package level as long as
the latter are "free-floating", i.e., not associated with any declaration documentation.
rsc commented 10 years ago

Comment 5:

Labels changed: added repo-tools.

rsc commented 10 years ago

Comment 6:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

dmitshur commented 4 years ago

And godoc.org completely ignores them

This might've been true at the time that comment was made (in 2013), but by now, they are displayed on godoc.org as well as on pkg.go.dev.

a nice UI for [...] presenting BUG(foo), TODO(bar) etc.

Various websites that display Go package documentation so far have used slightly different URL schemes for linking to these sections. Compare:

Pkg.go.dev has so far followed suit from x/tools/cmd/godoc, but perhaps it would be better to make the fragment in the URL lower case. These URLs are used relatively infrequently, so if there can be a usability improvement made, it might not be too late. As more time passes, it becomes more expensive to make any change, and the current scheme is more likely to stay.

/cc @julieqiu