mirror of
https://github.com/golang/go.git
synced 2024-09-21 10:28:27 +00:00
cmd/go: add telemetry for a predefined set of GOROOT values
For #58894 Change-Id: Ia30a3a1a9c7b611f55701956c08caa967634cd5a Reviewed-on: https://go-review.googlesource.com/c/go/+/586138 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
80964338a5
commit
a55edb7b55
@ -124,6 +124,20 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", cfg.GOROOT)
|
||||
os.Exit(2)
|
||||
}
|
||||
switch strings.ToLower(cfg.GOROOT) {
|
||||
case "/usr/local/go": // Location recommended for installation on Linux and Darwin and used by Mac installer.
|
||||
telemetry.Inc("go/goroot:usr-local-go")
|
||||
case "/usr/lib/go": // A typical location used by Linux package managers.
|
||||
telemetry.Inc("go/goroot:usr-lib-go")
|
||||
case "/usr/lib/golang": // Another typical location used by Linux package managers.
|
||||
telemetry.Inc("go/goroot:usr-lib-golang")
|
||||
case `c:\program files\go`: // Location used by Windows installer.
|
||||
telemetry.Inc("go/goroot:program-files-go")
|
||||
case `c:\program files (x86)\go`: // Location used by 386 Windows installer on amd64 platform.
|
||||
telemetry.Inc("go/goroot:program-files-x86-go")
|
||||
default:
|
||||
telemetry.Inc("go/goroot:other")
|
||||
}
|
||||
|
||||
// Diagnose common mistake: GOPATH==GOROOT.
|
||||
// This setting is equivalent to not setting GOPATH at all,
|
||||
|
Loading…
Reference in New Issue
Block a user