Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: GOTELEMETRY is not documented by go help environment #68928

Closed
stapelberg opened this issue Aug 18, 2024 · 10 comments
Closed

cmd/go: GOTELEMETRY is not documented by go help environment #68928

stapelberg opened this issue Aug 18, 2024 · 10 comments
Assignees
Labels
Documentation telemetry x/telemetry issues

Comments

@stapelberg
Copy link
Contributor

stapelberg commented Aug 18, 2024

Go version

go version go1.23.0 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/michael/.cache/go-build'
GOENV='/home/michael/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/michael/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/michael/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/michael/sdk/go1.23.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/michael/sdk/go1.23.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/michael/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1379730748=/tmp/go-build -gno-record-gcc-switches'

What did you do?

In a complex integration test setup which runs the go tool with a custom (ephemeral) XDG_CONFIG_HOME and HOME directory, I want to entirely turn off go telemetry: I found telemetry to trigger go module downloads that end up polluting my ephemeral module cache:

testing.go:1232: TempDir RemoveAll cleanup: unlinkat /tmp/TestGokRun3431683770/001/go/pkg/mod/golang.org/x/telemetry/config@v0.29.0/doc.go: permission denied

(This failure seems to have started with Go 1.23, but I’m having trouble reproducing it outside of GitHub Actions.)

What did you see happen?

I tried setting GOTELEMETRY in the environment, but it has no effect:

% go env GOTELEMETRY
local
% GOTELEMETRY=off go env GOTELEMETRY 
local

I also tried setting GOTELEMETRY in GOROOT/go.env, but it has no effect there either (whereas GOAMD64 has, so I’m editing the right file):

% go env GOAMD64                                          
v1                         
% echo 'GOAMD64=v3' >> '/home/michael/sdk/go1.23.0'/go.env
% go env GOAMD64                                          
v3
% echo 'GOTELEMETRY=off' >> '/home/michael/sdk/go1.23.0'/go.env
% go env GOTELEMETRY                                           
local

What did you expect to see?

I would have expected GOTELEMETRY=off to be honored.

In #67111, I can see mention of GOTELEMETRY being an unsettable environment variable. While I understand the rationale for go telemetry on being the only way to enable telemetry, I don’t think that applies to turning off telemetry, which I think should be possible via the environment.

@seankhliao
Copy link
Member

like GOMOD, it's there only to report the current state, not to allow modifications.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2024
@zigo101
Copy link

zigo101 commented Aug 18, 2024

like GOMOD, it's there only to report the current state, not to allow modifications.

It is absolutely not the case.

This issue should be re-opened.

@ianlancetaylor
Copy link
Contributor

@golang/telemetry :

Should setting the GOTELEMETRY environment variable affect whether we record telemetry? Do we ever document that that is how it behaves? Thanks.

@findleyr findleyr changed the title cmd/go: GOTELEMETRY=off environment variable has no effect cmd/go: support GOTELEMETRY=off as a means to disable telemetry Aug 20, 2024
@findleyr findleyr changed the title cmd/go: support GOTELEMETRY=off as a means to disable telemetry cmd/go: GOTELEMETRY is not documented by go help environment Aug 20, 2024
@findleyr
Copy link
Contributor

findleyr commented Aug 20, 2024

Should setting the GOTELEMETRY environment variable affect whether we record telemetry? Do we ever document that that is how it behaves? Thanks.

That's not how it behaves. See this comment from the proposal: #67111 (comment).

I think this needs to be documented, at least at the bottom of go help environment, but also at go help telemetry and go.dev/doc/telemetry.

I also recall that we've discussed making GOTELEMETRY settable, and I believe there has been no objection to supporting that, apart from the confusing asymmetry that we'd never support GOTELEMETRY=on (as @stapelberg astutely assessed). Let's reopen this issue to track improving the documentation, and open a separate issue for making GOTELEMETRY=off settable.

The issue with GOMODCACHE is tracked by #68946, and I consider it a bug that we should fix for 1.23.1.

@findleyr
Copy link
Contributor

Filed #68960 to formally consider supporting GOTELEMETRY=off in the environment.

@zigo101
Copy link

zigo101 commented Aug 20, 2024

BTW, it looks go clean -telemetry doesn't work. What is the current implementation way to clean telemetry data?

@findleyr
Copy link
Contributor

@zigo101 you can install golang.org/telemetry/cmd/gotelemetry and run gotelemetry clean.

You can also delete files in os.UserConfigDir()/go/telemetry. You may want to keep the mode file if it is set to off.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/607855 mentions this issue: cmd/go: document unsettable GOTELEMETRY and GOTELEMETRYDIR go env vars

gopherbot pushed a commit that referenced this issue Aug 22, 2024
This change adds documentation to "go help telemetry" and "go help
environment" for the unsettable GOTELEMETRY and GOTELEMETRYDIR go env
variables.

For #68928

Change-Id: I8c139bd8585ffb0c45b9dd722ef6e7a9a33df192
Reviewed-on: https://go-review.googlesource.com/c/go/+/607855
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@findleyr findleyr added the telemetry x/telemetry issues label Aug 26, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/616916 mentions this issue: _content/doc: add information about telemetry env vars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation telemetry x/telemetry issues
Projects
None yet
Development

No branches or pull requests

8 participants