Skip to content

cmd/go: repeated run pkg@version calls hit the proxy for no apparent reason #72944

@mvdan

Description

@mvdan

Go version

go version go1.24.1 linux/amd64

Output of go env in your module/workspace:

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

What did you do?

Ran go run -x honnef.co/go/tools/cmd/[email protected] -version a number of times.

What did you see happen?

$ go run -x honnef.co/go/tools/cmd/[email protected] -version
WORK=/tmp/go-build3841505877
# get https://proxy.golang.org/honnef.co/go/tools/@v/list
# get https://proxy.golang.org/honnef.co/go/tools/@v/list: 200 OK (0.043s)
/home/mvdan/.cache/go-build/ce/cefc08a55ed89b9e6ccbf96cc8155a15c7b548b63404c0988cc5b9998be24db2-d/staticcheck -version
staticcheck 2024.1.1 (0.5.1)
$ go run -x honnef.co/go/tools/cmd/[email protected] -version
WORK=/tmp/go-build1725445701
# get https://proxy.golang.org/honnef.co/go/tools/@v/list
# get https://proxy.golang.org/honnef.co/go/tools/@v/list: 200 OK (0.044s)
/home/mvdan/.cache/go-build/ce/cefc08a55ed89b9e6ccbf96cc8155a15c7b548b63404c0988cc5b9998be24db2-d/staticcheck -version
staticcheck 2024.1.1 (0.5.1)
$ go run -x honnef.co/go/tools/cmd/[email protected] -version
WORK=/tmp/go-build1793441905
# get https://proxy.golang.org/honnef.co/go/tools/@v/list
# get https://proxy.golang.org/honnef.co/go/tools/@v/list: 200 OK (0.049s)
/home/mvdan/.cache/go-build/ce/cefc08a55ed89b9e6ccbf96cc8155a15c7b548b63404c0988cc5b9998be24db2-d/staticcheck -version
staticcheck 2024.1.1 (0.5.1)

What did you expect to see?

I would expect the repeated runs to not hit GOPROXY at all; the module version is fully cached locally via GOMODCACHE.

Note that this is separate from go run caching binaries now. Even without caching of binaries, I would expect the local module cache to be sufficient so that the build can happen without hitting GOPROXY.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.GoCommandcmd/goNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions