[go] cmd/go/internal/doc: clear packageCache before building pkgsite

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jun 8, 2026, 10:53:58 AM (4 days ago) Jun 8
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Michael Matloob, Dmitri Shuralyov, Michael Matloob, Dmitri Shuralyov, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/go/internal/doc: clear packageCache before building pkgsite

When running go doc -http <pkg>, initial package parsing loads <pkg> with
IgnoreImports: true, storing the incomplete package object in load.packageCache.
When subsequently building pkgsite in-process within the same invocation
(introduced in CL 763760), load.PackagesAndErrorsOutsideModule reuses the
cached incomplete package object from packageCache, omitting its standard library
dependencies from the action graph and causing compilation to fail.

Fix this by clearing load.packageCache at the start of buildPkgsite.

Fixes #79846
Change-Id: Ibef6eed8280173f536a6ec72450963c802feba39
Reviewed-by: Michael Matloob <mat...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Auto-Submit: Hyang-Ah Hana Kim <hya...@gmail.com>
Reviewed-by: Michael Matloob <mat...@golang.org>
Files:
  • M src/cmd/go/internal/doc/pkgsite.go
  • M src/cmd/go/internal/load/pkg.go
  • A src/cmd/go/testdata/mod/golang.org_x_pkgsite_v0.1.0.txt
  • A src/cmd/go/testdata/script/doc_http_build.txt
Change size: S
Delta: 4 files changed, 42 insertions(+), 1 deletion(-)
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: go
Gerrit-Branch: master
Gerrit-Change-Id: Ibef6eed8280173f536a6ec72450963c802feba39
Gerrit-Change-Number: 787660
Gerrit-PatchSet: 6
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages