[go] cmd/go: do not collect build information for test packages when not needed

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Feb 12, 2026, 3:12:18 PM (15 hours ago) Feb 12
to Pierre Gimalac, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Ian Alexander, Michael Matloob, Michael Matloob, Go LUCI, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/go: do not collect build information for test packages when not needed

When build information is not needed for go list output (when -export=false and Stale and StaleReason fields are not printed), the "SuppressBuildInfo" option is set to true, so that cmd/go/internal/load does not collect it (in particular VCS information, which is costly to compute).
However the option is only checked in "PackagesAndErrors", not in "TestPackagesAndErrors", so when running go list -test=true, build information is still collected, significantly increasing the duration of the command.

This CL updates TestPackagesAndErrors to check SuppressBuildInfo before calling setBuildInfo, like PackagesAndErrors does.

Fixes #77419
Change-Id: I13f60d179c26d79d94899498f76ba9093566eeb6
Reviewed-by: Michael Matloob <mat...@google.com>
Reviewed-by: Ian Alexander <ji...@google.com>
Auto-Submit: Ian Alexander <ji...@google.com>
Reviewed-by: Sean Liao <se...@liao.dev>
Files:
  • M src/cmd/go/internal/load/test.go
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Michael Matloob, +2 by Sean Liao, +2 by Ian Alexander
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
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: I13f60d179c26d79d94899498f76ba9093566eeb6
Gerrit-Change-Number: 740901
Gerrit-PatchSet: 2
Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Alexander <ji...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages