Revert "cmd/internal/doc: allow reading packages from module cache" This reverts CL 815900 (commit b687f4531903f3d3f9f772535500ac084d4dde60). Reason for revert: it broke `go doc -http` and `go doc -http <stdlib_package>` pkgsite.BuildServer sets Paths to ["."] only when len(Paths) == 0 && !UseCache && Proxy == nil. The doc command sends no Paths of its own, so UseCache cancelled that default. No local getter was built, which means packages in the local workspace don't load either. UseCache also put a module cache getter ahead of the stdlib getter. Since stdlib packages are not likely in the module cache, and even when they do, they are under a specially named module, the module cache getter faces module.EscapePath(<package>) failure and that results in HTTP 500. `go doc -http errors` or `go doc -http` outside a module that opens /std fails. The reverted CL did not achieve what it set out to do either. The go command drops the version when it builds the URL for the documentation server, so "go doc -http pkg@v1.4.0" opens /pkg and the server shows the newest version in the cache, not the intended version. Fixing that needs a change in cmd/go. For golang/go#78459 Change-Id: I122ddf08dbd1f50b46397c97edc49e086a6a6964 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/831604 Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/cmd/internal/doc/main.go b/cmd/internal/doc/main.go index cdd6350..a361d14 100644 --- a/cmd/internal/doc/main.go +++ b/cmd/internal/doc/main.go
@@ -47,7 +47,6 @@ ctx := context.Background() server, err := pkgsite.BuildServer(ctx, pkgsite.ServerConfig{ GoDocMode: true, - UseCache: true, UseListedMods: true, UseLocalStdlib: true, GoRepoPath: *goRepoPath,