Skip to content

Commit 065c5d2

Browse files
committed
cmd/go: check checkCounters counter read only on supported platforms
Telemetry counters writing is disabled on certain platforms. See x/telemetry/internal/telemetry.DisabledOnPlatform. For #66205 Change-Id: I833e15ae33fb27e09d67fc77b921498476237176 Reviewed-on: https://go-review.googlesource.com/c/go/+/570196 Reviewed-by: Michael Matloob <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent bc20704 commit 065c5d2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/cmd/go/script_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func checkCounters(t *testing.T, telemetryDir string) {
411411
})
412412
counters := readCounters(t, telemetryDir)
413413
if _, ok := scriptGoInvoked.Load(testing.TB(t)); ok {
414-
if len(counters) == 0 {
414+
if !disabledOnPlatform && len(counters) == 0 {
415415
t.Fatal("go was invoked but no counters were incremented")
416416
}
417417
}
@@ -422,3 +422,19 @@ func checkCounters(t *testing.T, telemetryDir string) {
422422
}
423423
}
424424
}
425+
426+
// Copied from https://go.googlesource.com/telemetry/+/5f08a0cbff3f/internal/telemetry/mode.go#122
427+
// TODO(go.dev/issues/66205): replace this with the public API once it becomes available.
428+
//
429+
// disabledOnPlatform indicates whether telemetry is disabled
430+
// due to bugs in the current platform.
431+
const disabledOnPlatform = false ||
432+
// The following platforms could potentially be supported in the future:
433+
runtime.GOOS == "openbsd" || // #60614
434+
runtime.GOOS == "solaris" || // #60968 #60970
435+
runtime.GOOS == "android" || // #60967
436+
runtime.GOOS == "illumos" || // #65544
437+
// These platforms fundamentally can't be supported:
438+
runtime.GOOS == "js" || // #60971
439+
runtime.GOOS == "wasip1" || // #60971
440+
runtime.GOOS == "plan9" // https://github.com/golang/go/issues/57540#issuecomment-1470766639

0 commit comments

Comments
 (0)