mirror of https://github.com/golang/go.git
cmd/go: print the proper error message for setting telemetry vars
For #68960 Change-Id: I5495b3d45ad3817d7edf6336a5e24a331d5cf8d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/609115 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
This commit is contained in:
parent
e126129d76
commit
fe63d483f4
|
|
@ -590,7 +590,7 @@ func getOrigEnv(key string) string {
|
|||
|
||||
func checkEnvWrite(key, val string) error {
|
||||
switch key {
|
||||
case "GOEXE", "GOGCCFLAGS", "GOHOSTARCH", "GOHOSTOS", "GOMOD", "GOWORK", "GOTOOLDIR", "GOVERSION":
|
||||
case "GOEXE", "GOGCCFLAGS", "GOHOSTARCH", "GOHOSTOS", "GOMOD", "GOWORK", "GOTOOLDIR", "GOVERSION", "GOTELEMETRY", "GOTELEMETRYDIR":
|
||||
return fmt.Errorf("%s cannot be modified", key)
|
||||
case "GOENV", "GODEBUG":
|
||||
return fmt.Errorf("%s can only be set using the OS environment", key)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,6 @@ go env
|
|||
stdout 'GOTELEMETRY=''?on''?'
|
||||
stdout 'GOTELEMETRYDIR=''?'$userconfig'[\\/]go[\\/]telemetry''?'
|
||||
! go env -w GOTELEMETRY=off
|
||||
stderr '^go: unknown go command variable GOTELEMETRY$'
|
||||
stderr '^go: GOTELEMETRY cannot be modified$'
|
||||
! go env -w GOTELEMETRYDIR=foo
|
||||
stderr '^go: unknown go command variable GOTELEMETRYDIR$'
|
||||
stderr '^go: GOTELEMETRYDIR cannot be modified$'
|
||||
Loading…
Reference in New Issue