Skip to content

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

@stapelberg

Description

@stapelberg

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.

Metadata

Metadata

Labels

DocumentationIssues describing a change to documentation.telemetryx/telemetry issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions