golang/go

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

オープン

#45,485 opened on 2021/04/10

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)Go (19,008 件のフォーク)batch import
GoCommandNeedsInvestigationhelp wantedmodules

Repository metrics

Stars
 (133,883 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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

コントリビューターガイド