aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/script_test.go
diff options
context:
space:
mode:
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>2024-03-08 16:23:36 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2024-03-09 04:24:30 +0000
commit065c5d220e802e85d410a5e6adba0819ab71aeda (patch)
tree68df0e549cf25bb6c54b25dce2f16a829d1c32b2 /src/cmd/go/script_test.go
parentbc20704c265be3c5c6696dd703202ecef9b31d4f (diff)
downloadgo-065c5d220e802e85d410a5e6adba0819ab71aeda.tar.gz
go-065c5d220e802e85d410a5e6adba0819ab71aeda.zip
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 <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/go/script_test.go')
-rw-r--r--src/cmd/go/script_test.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index 6daa5d9e9a..d36de720cd 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -411,7 +411,7 @@ func checkCounters(t *testing.T, telemetryDir string) {
})
counters := readCounters(t, telemetryDir)
if _, ok := scriptGoInvoked.Load(testing.TB(t)); ok {
- if len(counters) == 0 {
+ if !disabledOnPlatform && len(counters) == 0 {
t.Fatal("go was invoked but no counters were incremented")
}
}
@@ -422,3 +422,19 @@ func checkCounters(t *testing.T, telemetryDir string) {
}
}
}
+
+// Copied from https://go.googlesource.com/telemetry/+/5f08a0cbff3f/internal/telemetry/mode.go#122
+// TODO(go.dev/issues/66205): replace this with the public API once it becomes available.
+//
+// disabledOnPlatform indicates whether telemetry is disabled
+// due to bugs in the current platform.
+const disabledOnPlatform = false ||
+ // The following platforms could potentially be supported in the future:
+ runtime.GOOS == "openbsd" || // #60614
+ runtime.GOOS == "solaris" || // #60968 #60970
+ runtime.GOOS == "android" || // #60967
+ runtime.GOOS == "illumos" || // #65544
+ // These platforms fundamentally can't be supported:
+ runtime.GOOS == "js" || // #60971
+ runtime.GOOS == "wasip1" || // #60971
+ runtime.GOOS == "plan9" // https://github.com/golang/go/issues/57540#issuecomment-1470766639