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: 'go list -m' wildcards don't work with version queries #45485

Open
bcmills opened this issue Apr 10, 2021 · 4 comments · May be fixed by #45719
Open

cmd/go: 'go list -m' wildcards don't work with version queries #45485

bcmills opened this issue Apr 10, 2021 · 4 comments · May be fixed by #45719
Labels
GoCommand cmd/go help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Apr 10, 2021

go get supports ... wildcards, and supports version queries such as @latest, and allows the user to combine the two in the obvious way.

go list -m supports ... wildcards, and supports version queries such as @latest. However, it errors out when both are used in the same argument. It should not — it should instead interpret those queries analogous to how go get does.

$ go version
go version devel go1.17-a7e16abb2 Thu Apr 8 07:33:58 2021 +0000 linux/amd64

$ go mod init example.com
go: creating new go.mod: module example.com

$ go get -d golang.org/x/tools/...@latest
go: downloading golang.org/x/tools v0.1.0
go: downloading golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
go: downloading golang.org/x/mod v0.3.0
go: downloading golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
go: downloading github.com/yuin/goldmark v1.2.1
go get: added golang.org/x/tools v0.1.0

$ go list -m golang.org/x/tools/...
golang.org/x/tools v0.1.0

$ go list -m golang.org/x/tools@latest
golang.org/x/tools v0.1.0

$ go list -m golang.org/x/tools/...@latest
go list -m: golang.org/x/tools/...@latest: malformed module path "golang.org/x/tools/...": invalid path element "..."

$

I noticed this while updating go list for #36460.

CC @jayconrod @matloob

@bcmills bcmills added help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels Apr 10, 2021
@bcmills bcmills added this to the Backlog milestone Apr 10, 2021
@anton-kuklin
Copy link
Contributor

Hi @bcmills, I'll work on it.

@jamdagni86
Copy link
Contributor

hey @justplesh would it be OK if I can send a pull request for this? I am almost done with the fix.

@anton-kuklin
Copy link
Contributor

@jamdagni86 sure, if you have already done it - it's great.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/312950 mentions this issue: cmd/go: add support for wildcards in 'go list -m'

jamdagni86 added a commit to jamdagni86/go that referenced this issue May 4, 2021
go list -m supports wildcards. however, when combined with version queries, it errors out. the commit makes it work when both are provided.

Fixes golang#45485
jamdagni86 added a commit to jamdagni86/go that referenced this issue May 12, 2021
go list -m supports wildcards. however, when combined with version queries, it errors out. the commit makes it work when both are provided.

Fixes golang#45485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants