cmd/go: add VCS telemetry counter

Change-Id: I601b842f8690f723682dccca0df778f124ac99a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/729500
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Roland Shoemaker
2025-12-11 18:09:46 -05:00
committed by Gopher Robot
parent 080aa8e964
commit 75cfb36608

View File

@@ -27,6 +27,7 @@ import (
"cmd/go/internal/str"
"cmd/go/internal/web"
"cmd/internal/pathcache"
"cmd/internal/telemetry/counter"
"golang.org/x/mod/module"
)
@@ -872,6 +873,12 @@ func RepoRootForImportPath(importPath string, mod ModuleMode, security web.Secur
rr = nil
err = importErrorf(importPath, "cannot expand ... in %q", importPath)
}
// Record telemetry about which VCS was used.
if err == nil {
counter.Inc("go/vcs:" + rr.VCS.Name)
}
return rr, err
}