gddo-server: add global "Uses" links (alongside permalinks)

Each definition's "Uses" link points to the definition's page on
Sourcegraph, which shows where the definition is used (across all
indexed open-source repositories). This lets library users see "usage
examples" and gives library authors information about how their
library's API is being used.

It is necessary to store the value of go/doc.Func.Orig (the original
receiver name, see when building
documentation. Previously, only go/doc.Func.Recv (actual receiver
name) was stored. The original receiver name can differ from actual
due to struct embedding.

This change was originally submitted and OK'd by adg at

A gddo server with this change applied is temporarily available at

Change-Id: Ifa7773b56ccc08c8f063730bdf1fa441d9728d5c
Reviewed-by: Andrew Gerrand <>
5 files changed