golang / go

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

x/tools/cmd/godoc: support company-specific doc annotations #8586

Open bradfitz opened 10 years ago

bradfitz commented 10 years ago
Google internally runs a godoc server serving docs for the standard library + all of
Google $GOPATH (all internal Google Go code).

In many cases, we'd like to mention the Google-specific libraries or ways of doing
things from the standard library docs.

It would be nice if there were a file we could maintain that appended company-specific
doc annotations to the standard library on at least:

-- packages
-- funcs
-- types
-- specific fields on struct types
adg commented 10 years ago

Comment 1:

We could also just modify the source tree internally at Google, rather than adding a
bunch of hooks to godoc.
bradfitz commented 10 years ago

Comment 2:

That's a possibility.
But doing it naively with patch files that would go stale over time as the standard
library changes would be a pain, so we'd want to not use diff+patch and an go/*-based
AST patcher instead. Once we have that, the godoc hooks aren't much more work and could
benefit other companies. Google's not unique in this regard.
adg commented 10 years ago

Comment 3:

A general tool for patching doc comments would also be generally useful. :-)
Either way it's done, the source format ("add this annotation to this doc comment") will
be the same.