]> Cypherpunks repositories - gostls13.git/commit
cmd/go: call telemetry.MaybeChild at start of go command
authorMichael Matloob <matloob@golang.org>
Thu, 13 Jun 2024 16:38:20 +0000 (12:38 -0400)
committerMichael Matloob <matloob@golang.org>
Thu, 13 Jun 2024 19:19:47 +0000 (19:19 +0000)
commitdbe03e4831206d7311e4423c3a988fc48beda2bd
treea417b2026482689a40634b18a13ed786cc6147d3
parent956f8a67dd7319bad60c015d982f0b2e95b9f382
cmd/go: call telemetry.MaybeChild at start of go command

Call the new telemetry.MaybeChild function at the start of the go
command so that the child process logic can be run immediately without
running toolchain selection if this is the child process.

The Start function in the telemetry shim package has been renamed to
OpenCounters to make it clear that that's its only function.

The StartWithUpload function in the telemetry shim package has been
renamed to MaybeParent because that's its actual effective behavior in
cmd/go, the only place it's called: it won't run as the child because
MaybeChild has already been called and would have run as the child if
the program was the telemetry child, and it won't open counters because
telemetry.Start has been called. Checks are added that those functions
are always called before so that the function name and comment are
accurate.

It might make sense to add a true telemetry.MaybeParent function that
doesn't try to start the child or open counters to make things a little
simpler.

Change-Id: Ie81e2418af85cef18ec41f75db66365f6597b8b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/592535
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
23 files changed:
src/cmd/addr2line/main.go
src/cmd/asm/main.go
src/cmd/buildid/buildid.go
src/cmd/cgo/main.go
src/cmd/compile/internal/gc/main.go
src/cmd/covdata/covdata.go
src/cmd/cover/cover.go
src/cmd/distpack/pack.go
src/cmd/doc/main.go
src/cmd/fix/main.go
src/cmd/go/main.go
src/cmd/gofmt/gofmt.go
src/cmd/internal/telemetry/telemetry.go
src/cmd/internal/telemetry/telemetry_bootstrap.go
src/cmd/link/internal/ld/main.go
src/cmd/nm/nm.go
src/cmd/objdump/main.go
src/cmd/pack/pack.go
src/cmd/pprof/pprof.go
src/cmd/preprofile/main.go
src/cmd/test2json/main.go
src/cmd/trace/main.go
src/cmd/vet/main.go