Skip to content

cmd/go: list -m -json often missing .Origin #67363

@josharian

Description

@josharian

Go version

go version go1.22.3 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users/josh/bin'
GOCACHE='/Users/josh/Library/Caches/go-build'
GOENV='/Users/josh/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/josh/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/josh'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/josh/go/1.22'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/josh/go/1.22/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/vm/htvrhp4177v2dfhdjlvl0pqh0000gn/T/go-build2633414260=/tmp/go-build -gno-record-gcc-switches -fno-common'

Bug report

This is a regression. With Go 1.22.3:

$ go list -m -json golang.org/x/tools@latest
{
	"Path": "golang.org/x/tools",
	"Version": "v0.21.0",
	"Query": "latest",
	"Time": "2024-05-06T16:54:44Z",
	"GoMod": "/Users/josh/pkg/mod/cache/download/golang.org/x/tools/@v/v0.21.0.mod",
	"GoVersion": "1.19"
}

Note that there is no Origin field.

With Go 1.21.10:

$ go list -m -json golang.org/x/tools@latest
{
	"Path": "golang.org/x/tools",
	"Version": "v0.21.0",
	"Query": "latest",
	"Time": "2024-05-06T16:54:44Z",
	"GoMod": "/Users/josh/pkg/mod/cache/download/golang.org/x/tools/@v/v0.21.0.mod",
	"GoVersion": "1.19",
	"Origin": {
		"VCS": "git",
		"URL": "https://go.googlesource.com/tools",
		"Ref": "refs/tags/v0.21.0",
		"Hash": "cc29c91ba3acb47c1793da56d919cc40def4ea41"
	}
}

Given the conversation in #57051, it is clear that the intent is that the Origin field be present.

Relevant to #18387.

Metadata

Metadata

Assignees

Labels

GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.modules

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions