From: qmuntal Date: Fri, 26 Sep 2025 09:39:02 +0000 (+0200) Subject: cmd/go/internal/telemetrystats: count cgo usage X-Git-Tag: go1.26rc1~400 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f93186fb44;p=gostls13.git cmd/go/internal/telemetrystats: count cgo usage Knowing how many times cgo is used is useful information to have in the local telemetry database. It also opens the door for uploading them in the future if desired. Change-Id: Ia92b11fc489f015bbface7f28ed5a5c2871c44f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/707055 Reviewed-by: Michael Matloob LUCI-TryBot-Result: Go LUCI Reviewed-by: Robert Findley Reviewed-by: Michael Matloob Reviewed-by: Florian Lehner --- diff --git a/src/cmd/go/internal/telemetrystats/telemetrystats.go b/src/cmd/go/internal/telemetrystats/telemetrystats.go index 84b4ae2e84..f533a4ce3d 100644 --- a/src/cmd/go/internal/telemetrystats/telemetrystats.go +++ b/src/cmd/go/internal/telemetrystats/telemetrystats.go @@ -32,6 +32,13 @@ func incrementConfig() { } else { counter.Inc("go/mode:module") } + + if cfg.BuildContext.CgoEnabled { + counter.Inc("go/cgo:enabled") + } else { + counter.Inc("go/cgo:disabled") + } + counter.Inc("go/platform/target/goos:" + cfg.Goos) counter.Inc("go/platform/target/goarch:" + cfg.Goarch) switch cfg.Goarch {