CL 585235 added telemetry for commands in cmd, except for cmd/dist.

Since cmd/dist is built with the bootstrap toolchain, enabling telemetry requires Go 1.23 or later.

Go 1.24 requires Go 1.22 for bootstrapping, and Go 1.26 will require Go 1.24 or later, as described in golang/go#69315. If I understand correctly, we will need to wait until the Go 1.26 dev cycle to enable telemetry in cmd/dist.

I'm trying to prototype telemetry in cmd/dist and compile it using Go 1.24 as the bootstrap toolchain to validate this, but I'm encountering the following error:

Building Go cmd/dist using /usr/lib/go. (go1.24.0 linux/amd64)
package ./cmd/dist
        cmd/dist/util.go:21:2: use of internal package cmd/internal/telemetry/counter not allowed

I'm not sure whether this means cmd/dist should be allowed to import internal packages in 1.24 or if the issue is unrelated. Either way, we will need to address this at some point, so it's still worth including this issue in a milestone.

cc @golang/telemetry

Comment From: ianlancetaylor

The make.bash script is basically using the bootstrap Go toolchain (in this case 1.24) to run the command go build ./cmd/dist. So from the bootstrap toolchain's point of view it's just building some random program. And random programs aren't permitted to import internal packages. So currently cmd/dist can only import ordinary visible packages, which is all that it currently does import.

Note that cmd/dist already copies some standard library code into its own sources, such as copying part of go/build into cmd/dist/imports.go. Perhaps something along those lines could work here.

That said do we expect to learn much from enabling telemetry for cmd/dist?

Comment From: mauri870

Thanks, perhaps I'm focusing too much on whether I could rather than whether I should. A comment in the CL says it will eventually be enabled for cmd/dist, but I think the telemetry team would have a better understanding of the reasoning behind that.

Comment From: matloob

@mauri870 My comment on CL 585235 was a mistake. I think we'd have to copy the code if we wanted to do telemetry in cmd/dist. But that would be pretty messy since we depend on vendored x/telemetry code, so I don't think we should.

Comment From: findleyr

Agreed, I think until there is a strong reason for telemetry in cmd/dist, let's not worry about it.