[go] cmd/go: include 'dist' in 'go tool' list

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Aug 14, 2026, 11:04:22 PM (2 days ago) Aug 14
to rui xi, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Dmitri Shuralyov, Dmitri Shuralyov, Michael Matloob, Michael Matloob, golang...@luci-project-accounts.iam.gserviceaccount.com, Russ Cox, Prince Roshan, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/go/internal/tool: include all builtin tools in 'go tool' listing

cmd/distpack strips some tools (dist, nm, objdump, pprof, etc.) from
the binary distribution to save space. Previously, 'go tool' only listed
tools found in the tool directory, so these stripped tools were missing.

Instead, also enumerate standard cmd/ packages from $GOROOT/src/cmd/
that are buildable main packages. To avoid listing non-tool packages,
loadBuiltinTool now verifies the package is actually "main" using
go/parser (excluding _test.go files, since cmd/api has only test files).

Fixes #75960.
Change-Id: I0446af11fc96974ade3c424c486f0738d12c5be8
Auto-Submit: Sean Liao <se...@liao.dev>
Reviewed-by: Michael Matloob <mat...@google.com>
Reviewed-by: Michael Matloob <mat...@golang.org>
Reviewed-by: Sean Liao <se...@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Files:
  • M src/cmd/go/internal/tool/tool.go
  • A src/cmd/go/testdata/script/tool_list_builtin.txt
Change size: S
Delta: 2 files changed, 48 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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0446af11fc96974ade3c424c486f0738d12c5be8
Gerrit-Change-Number: 800840
Gerrit-PatchSet: 9
Gerrit-Owner: rui xi <ruixir...@gmail.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: rui xi <ruixir...@gmail.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-CC: Prince Roshan <princekr...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages