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 -mod=readonly -m all' spuriously fails with "cannot query module due to -mod=readonly #36478

Closed
bcmills opened this issue Jan 9, 2020 · 3 comments

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Jan 9, 2020

An issue reported by @robpike. Apparently something about go list -m is causing it to query modules, which fails when -mod=readonly is set.

go list -m all should never need to query modules, since it is only asking to list the modules that are already present in the dependency graph.

~/src/golang.org/x/build$ gotip version
go version devel +817afe83 Wed Jan 8 20:07:45 2020 +0000 linux/amd64

~/src/golang.org/x/build$ gotip list -mod=readonly -m all 2>&1 | head -n 5
go list -m: cannot query module due to -mod=readonly
go list -m: cannot query module due to -mod=readonly
go list -m: cannot query module due to -mod=readonly
go list -m: cannot query module due to -mod=readonly
go list -m: cannot query module due to -mod=readonly

CC @heschik @jayconrod @matloob

@bcmills bcmills added this to the Go1.14 milestone Jan 9, 2020
@bcmills bcmills self-assigned this Jan 9, 2020
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 9, 2020

Change https://golang.org/cl/214077 mentions this issue: cmd/go/internal/modload: do not disable Query for -mod=readonly

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 9, 2020

Change https://golang.org/cl/214081 mentions this issue: cmd/go: explicitly reject 'list -u' and 'list -versions' when '-mod=vendor' is set

@bcmills

This comment has been minimized.

Copy link
Member Author

@bcmills bcmills commented Jan 9, 2020

This is now fixed.

@bcmills bcmills closed this Jan 9, 2020
gopherbot pushed a commit that referenced this issue Jan 9, 2020
'go list -m' allows explicit module@version arguments,
which it resolves (using Query) but does not add to the build list.
Similarly, 'go list -u' resolves versions without modifying the build list.

These explicit operations should be allowed even when '-mod=readonly' is set.

Updates #36478

'go list' and 'go mod download' do not

Change-Id: I5d2735729ad573635b9c1902d5d3a8bd960b8a76
Reviewed-on: https://go-review.googlesource.com/c/go/+/214077
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
gopherbot pushed a commit that referenced this issue Jan 9, 2020
…endor' is set

The information requested by these flags is not available from the
vendor directory.

Noticed while diagnosing #36478.

Updates #33848

Change-Id: I2b181ba5c27f01fdd6277d8d0ab1003c05774ff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/214081
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.