go env doesn't seem to work well with GOTELEMETRY

93 views
Skip to first unread message

will....@gmail.com

unread,
Aug 20, 2024, 8:07:35 PM8/20/24
to golang-nuts
Despite showing up an an env var, it's not treated consistently as one:

❯ go telemetry off
# nothing printed
# as expected

❯ go env | grep GOTELEMETRY=
GOTELEMETRY='off'
# as expected

❯ go env GOTELEMETRY
off
# as expected

❯ go env -changed
# nothing printed
# as expected

❯ go env -u GOTELEMETRY
go: unknown go command variable GOTELEMETRY
# expected nothing printed, success

❯ go env -w GOTELEMETRY=on
go: unknown go command variable GOTELEMETRY
# expected nothing printed, success

❯ go telemetry on
# snip
# as expected

❯ go env | grep GOTELEMETRY=
GOTELEMETRY='on'
# as expected

❯ go env GOTELEMETRY
on
# as expected

❯ go env -changed
# nothing printed
# expected to be printed: GOTELEMETRY='on'

❯ go env -u GOTELEMETRY
go: unknown go command variable GOTELEMETRY
# expected nothing printed, success

❯ go env -w GOTELEMETRY=off
go: unknown go command variable GOTELEMETRY
# expected nothing printed, success

Ian Lance Taylor

unread,
Aug 20, 2024, 9:05:28 PM8/20/24
to will....@gmail.com, golang-nuts
These issues are being discussed on https://go.dev/issue/68960.

Ian

Will Faught

unread,
Aug 20, 2024, 10:01:16 PM8/20/24
to Ian Lance Taylor, golang-nuts
Thanks, but it looks like that issue is only about enabling `go env -w GOTELEMETRY=off`.

Isn't it incorrect for `go env GOTELEMETRY` to work, yet `go env -u GOTELEMETRY` prints `unknown go command variable GOTELEMETRY`? Shouldn't it insead print something like `go command variable GOTELEMETRY cannot be set with go env`?

Ian Lance Taylor

unread,
Aug 20, 2024, 11:14:49 PM8/20/24
to Will Faught, golang-nuts
On Tue, Aug 20, 2024 at 7:00 PM Will Faught <will....@gmail.com> wrote:
>
> Thanks, but it looks like that issue is only about enabling `go env -w GOTELEMETRY=off`.
>
> Isn't it incorrect for `go env GOTELEMETRY` to work, yet `go env -u GOTELEMETRY` prints `unknown go command variable GOTELEMETRY`? Shouldn't it insead print something like `go command variable GOTELEMETRY cannot be set with go env`?

I think every aspect of the GOTELEMETRY environment variable (if there
is going to be one) is fair game on that issue.

Ian
Reply all
Reply to author
Forward
0 new messages