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: list -m -json often missing .Origin #67363

Open
josharian opened this issue May 14, 2024 · 4 comments
Open

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

josharian opened this issue May 14, 2024 · 4 comments
Assignees
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

josharian commented May 14, 2024

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.

@findleyr
Copy link
Contributor

Interestingly, GOPROXY=direct go list -m -json golang.org/x/tools@latest seems to work every time.
The VCS info is present in the proxy: https://proxy.golang.org/golang.org/x/tools/@v/v0.21.0.info.

CC @matloob @samthanawalla

@josharian
Copy link
Contributor Author

@findleyr thanks! That's 80% of a workaround for me!

Unfortunately, the VCS info doesn't appear to always be present in the proxy: https://proxy.golang.org/rsc.io/edit/@v/v1.0.0.info

@findleyr
Copy link
Contributor

That VCS info is not always present is, I believe, a known limitation. (CC @suzmue to confirm). The decision was made to not reprocess older versions in the proxy--even ignoring compute resources, we can't guarantee that older versions still exist in at the origin.

But for x/tools@latest, VCS info is present, and yet not returned by go list. That seems like a bug.

@seankhliao
Copy link
Member

probably related #66077 (comment)
it does work if the version query is an actual version instead of latest

@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels May 14, 2024
@dmitshur dmitshur added this to the Backlog milestone May 14, 2024
@matloob matloob self-assigned this May 23, 2024
@matloob matloob added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants