Skip to content

Commit 8798f9e

Browse files
committed
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
1 parent 8097cf1 commit 8798f9e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/cmd/distpack/pack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ func main() {
167167
if !strings.HasPrefix(name, "pkg/tool/"+goosUnderGoarch+"/") {
168168
return false
169169
}
170-
// Inside pkg/tool/$GOOS_$GOARCH, discard helper tools.
170+
// Inside pkg/tool/$GOOS_$GOARCH, discard helper tools, and tools not needed for builds.
171171
switch strings.TrimSuffix(path.Base(name), ".exe") {
172-
case "api", "dist", "distpack", "metadata":
172+
case "addr2line", "api", "buildid", "dist", "distpack", "metadata", "nm", "objdump", "pprof", "test2json", "trace":
173173
return false
174174
}
175175
}

src/cmd/go/internal/work/buildid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ func (b *Builder) updateBuildID(a *Action, target string) error {
642642
sh := b.Shell(a)
643643

644644
if cfg.BuildX || cfg.BuildN {
645-
sh.ShowCmd("", "%s # internal", joinUnambiguously(str.StringList(base.Tool("buildid"), "-w", target)))
645+
sh.ShowCmd("", "%s # internal", joinUnambiguously(str.StringList("go", "tool", "buildid", "-w", target)))
646646
if cfg.BuildN {
647647
return nil
648648
}

0 commit comments

Comments
 (0)