Knowing which goexperiments are enabled by the users 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: I12c8eaa3997dec0ed26703885f1c216676f5590d
Reviewed-on: https://go-review.googlesource.com/c/go/+/688135
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
"cmd/go/internal/cfg"
"cmd/go/internal/modload"
"cmd/internal/telemetry/counter"
+ "strings"
)
func Increment() {
case "wasm":
counter.Inc("go/platform/target/gowasm:" + cfg.GOWASM)
}
+
+ // Use cfg.Experiment.String instead of cfg.Experiment.Enabled
+ // because we only want to count the experiments that differ
+ // from the baseline.
+ if cfg.Experiment != nil {
+ for exp := range strings.SplitSeq(cfg.Experiment.String(), ",") {
+ if exp == "" {
+ continue
+ }
+ counter.Inc("go/goexperiment:" + exp)
+ }
+ }
}