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' should be deterministic #28019

Closed
hyangah opened this issue Oct 4, 2018 · 1 comment
Closed

cmd/go: 'go list -m' should be deterministic #28019

hyangah opened this issue Oct 4, 2018 · 1 comment
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Oct 4, 2018

Unlike the package-based query (go list)
that would behave like go get underneath (#28014, #27643),
go list -m operates only with the modules already in the cache.
That makes the result stateful, often confusing.

For example,

# the module is not in our module cache yet.
$ go list -u --versions -m example.com/module
go list -m example.com/module: module "example.com/module" is not a known dependency

# package-level query.
$ go list example.com/module
go: finding example.com/module v1.0.0
go: downloading example.com/module v1.0.0
example.com/module

# now, let's run the same query.
$ go list -u --versions -m example.com/module
example.com/module v1.0.0
@hyangah hyangah added the modules label Oct 4, 2018
@bcmills bcmills added this to the Go1.13 milestone Nov 19, 2018
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 19, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 19, 2018

I think the underlying use-case is mostly addressed by the fix for #24250: every set of flags that works outside a module should also work inside a module, and go list -m -versions should pretty clearly work everywhere.

That said, go list -m is already deterministic: unless you provide a specific version (or the -versions flag) it restricts its answer to the modules active in the build list, and that set of modules is a deterministic function of the go.mod file.

@bcmills bcmills closed this as completed Nov 19, 2018
@golang golang locked and limited conversation to collaborators Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants