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

Comments

Projects
None yet
2 participants
@hyangah
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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 Nov 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.