mirror of
https://github.com/golang/go.git
synced 2026-06-28 03:40:37 +00:00
cmd/go: correct go/vcs counter names
Using rr.VCS.Name as done in CL 729500 works for vcsMod, but for all other VCSes the counter name would've ended up like go/vcs:Mercurial or go/vcs:Git. Use the Cmd field instead, it should be stable enough. For golang/go#76801. Change-Id: Ib36c4fcd49c44ebd7898b5bc40f5d63495cd90e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/774600 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
978f00ab7f
commit
edc5480072
1 changed files with 7 additions and 3 deletions
|
|
@ -125,7 +125,7 @@ var vcsList = []*Cmd{
|
|||
}
|
||||
|
||||
// vcsMod is a stub for the "mod" scheme. It's returned by
|
||||
// repoRootForImportPathDynamic, but is otherwise not treated as a VCS command.
|
||||
// repoRootForImportDynamic, but is otherwise not treated as a VCS command.
|
||||
var vcsMod = &Cmd{Name: "mod"}
|
||||
|
||||
// vcsByCmd returns the version control system for the given
|
||||
|
|
@ -795,9 +795,13 @@ func RepoRootForImportPath(importPath string, mod ModuleMode, security web.Secur
|
|||
err = importErrorf(importPath, "cannot expand ... in %q", importPath)
|
||||
}
|
||||
|
||||
// Record telemetry about which VCS was used.
|
||||
// Record telemetry about which VCS was found.
|
||||
if err == nil {
|
||||
counter.Inc("go/vcs:" + rr.VCS.Name)
|
||||
if rr.VCS == vcsMod {
|
||||
counter.Inc("go/vcs:mod")
|
||||
} else {
|
||||
counter.Inc("go/vcs:" + rr.VCS.Cmd)
|
||||
}
|
||||
}
|
||||
|
||||
return rr, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue