From: Michael Matloob Date: Thu, 6 Feb 2025 21:11:50 +0000 (-0500) Subject: cmd/distpack: remove some tools from packaged distribution X-Git-Tag: go1.25rc1~244 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8798f9e7a4929bafb570da29d342104c8cb32f9b;p=gostls13.git cmd/distpack: remove some tools from packaged distribution This change removes some tools that are not used for builds, or otherwise invoked by the go command (other than through "go tool" itself) from the packaged distributions produced by distpack. When these tools are missing, "go tool" will build and run them as needed. Also update a case where we print a buildid commandline to specify invoking buildid using "go tool" rather than the binary at it's install location, because it may not exist there in packaged distributions anymore. The tools in this CL are the lowest hanging fruit. There are a few more tools that aren't used by builds, but we'd have to get the go command to run them using "go tool" rather than finding them in the tool install directory. For #71867 Change-Id: I217683bd549962a1add87405bf3fb1225e2333c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/666755 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt Reviewed-by: Michael Matloob --- diff --git a/src/cmd/distpack/pack.go b/src/cmd/distpack/pack.go index a4f18da8bd..5b10198887 100644 --- a/src/cmd/distpack/pack.go +++ b/src/cmd/distpack/pack.go @@ -167,9 +167,9 @@ func main() { if !strings.HasPrefix(name, "pkg/tool/"+goosUnderGoarch+"/") { return false } - // Inside pkg/tool/$GOOS_$GOARCH, discard helper tools. + // Inside pkg/tool/$GOOS_$GOARCH, discard helper tools, and tools not needed for builds. switch strings.TrimSuffix(path.Base(name), ".exe") { - case "api", "dist", "distpack", "metadata": + case "addr2line", "api", "buildid", "dist", "distpack", "metadata", "nm", "objdump", "pprof", "test2json", "trace": return false } } diff --git a/src/cmd/go/internal/work/buildid.go b/src/cmd/go/internal/work/buildid.go index 9bf3ab9acc..0bf9ba1781 100644 --- a/src/cmd/go/internal/work/buildid.go +++ b/src/cmd/go/internal/work/buildid.go @@ -642,7 +642,7 @@ func (b *Builder) updateBuildID(a *Action, target string) error { sh := b.Shell(a) if cfg.BuildX || cfg.BuildN { - sh.ShowCmd("", "%s # internal", joinUnambiguously(str.StringList(base.Tool("buildid"), "-w", target))) + sh.ShowCmd("", "%s # internal", joinUnambiguously(str.StringList("go", "tool", "buildid", "-w", target))) if cfg.BuildN { return nil }