Skip to content

cmd/go: go list prints the wrong Origin data for the version resolved from a non-semver query #61423

@bcmills

Description

@bcmills

What version of Go are you using (go version)?

$ go version
go version devel go1.21-18e17e2c Thu Jun 29 23:06:46 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/bcmills/.cache/go-build'
GOENV='/usr/local/google/home/bcmills/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/tmp/tmp.oKChmSObvX/.gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/tmp/tmp.oKChmSObvX/.gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/bcmills/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/google/home/bcmills/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.21-18e17e2c Thu Jun 29 23:06:46 2023 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='c++'
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-build3913236638=/tmp/go-build -gno-record-gcc-switches'

What did you do?

$ go list -json -m -e golang.org/x/exp@master

What did you expect to see?

A result with either a non-cacheable Origin (currently, an empty Hash, TagSum, and RepoSum), or an Origin with a Ref matching the one we would need to re-resolve in the upstream repo.

What did you see instead?

When a proxy is used, the result may include a cacheable Origin, as if the command had requested the fully-resolved version instead of a query:

$ go list -json -m -e golang.org/x/exp@master
{
        "Path": "golang.org/x/exp",
        "Version": "v0.0.0-20230713183714-613f0c0eb8a1",
        "Query": "master",
        "Time": "2023-07-13T18:37:14Z",
        "GoMod": "/tmp/tmp.oKChmSObvX/.gopath/pkg/mod/cache/download/golang.org/x/exp/@v/v0.0.0-20230713183714-613f0c0eb8a1.mod",
        "GoVersion": "1.20",
        "Origin": {
                "VCS": "git",
                "URL": "https://go.googlesource.com/exp",
                "Hash": "613f0c0eb8a17a98ecdb096a7f9f7d5053c1c963"
        }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions