]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: don't start upload until after toolchain selection
authorMichael Matloob <matloob@golang.org>
Mon, 13 May 2024 18:59:02 +0000 (14:59 -0400)
committerMichael Matloob <matloob@golang.org>
Wed, 15 May 2024 21:51:49 +0000 (21:51 +0000)
Run telemetry.Start (without the upload) first thing so we can increment
counters in toolchain selection. Then run telemetry.StartWithUpload
after toolchain selection so we don't start the upload until after
toolchain selection has happened so we don't start something heavyweight
before selection.

Change-Id: Ia8979175a163265c3e29f6cb11a4ada4714d1d95
Reviewed-on: https://go-review.googlesource.com/c/go/+/585419
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
src/cmd/go/main.go

index 72656dd9035ca554d2d79a1e5fddefcc804bd96f..3fe5cd4ee18f06be060436ca164ae091e3fadd9b 100644 (file)
@@ -92,10 +92,11 @@ var counterErrorsGOPATHEntryRelative = telemetry.NewCounter("go/errors:gopath-en
 
 func main() {
        log.SetFlags(0)
-       telemetry.StartWithUpload() // Open the telemetry counter file so counters can be written to it.
+       telemetry.Start() // Open the telemetry counter file so counters can be written to it.
        handleChdirFlag()
        toolchain.Select()
 
+       telemetry.StartWithUpload() // Run the upload process. Opening the counter file is idempotent.
        flag.Usage = base.Usage
        flag.Parse()
        telemetry.Inc("go/invocations")