[pkgsite] internal/api: collect information for API doc page

0 views
Skip to first unread message

Jonathan Amsterdam (Gerrit)

unread,
Apr 14, 2026, 3:33:11 PM (19 hours ago) Apr 14
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, Hyang-Ah Hana Kim, golang-co...@googlegroups.com

Jonathan Amsterdam submitted the change

Change information

Commit message:
internal/api: collect information for API doc page

This is the first CL in a series that adds a documentation page
for the API. It just extracts all the information for the page
from the api.go file. A later CL will actually render the page.

Here we annotate ServeXXX functions with "api:" comments describing the
route. We read the file (api.go) and collect the comment information
into a struct.

We embed api.go so we can read it on demand. Although the data is
static, it's easier to regenerate it each time (on each page load). That
way we don't need to store it somewhere and check if it's out of date.
Parsing the page will be fast and the page won't be accessed that often.
We could also arrange for it to be cached locally, like many of our
pages.
Change-Id: Ifd1b1c7b60bdfa9752b06337807d02f9905bbf10
Reviewed-by: Ethan Lee <etha...@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
kokoro-CI: kokoro <noreply...@google.com>
Files:
  • M internal/api/api.go
  • A internal/api/docpage.go
  • A internal/api/docpage_test.go
Change size: L
Delta: 3 files changed, 272 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifd1b1c7b60bdfa9752b06337807d02f9905bbf10
Gerrit-Change-Number: 765304
Gerrit-PatchSet: 10
Gerrit-Owner: Jonathan Amsterdam <j...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages