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
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@bcmills
Copy link
Contributor

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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker modules labels Jan 9, 2020
@bcmills bcmills added this to the Go1.14 milestone Jan 9, 2020
@bcmills bcmills self-assigned this Jan 9, 2020
@gopherbot
Copy link

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

@gopherbot
Copy link

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

@bcmills
Copy link
Contributor Author

bcmills commented Jan 9, 2020

This is now fixed.

@bcmills bcmills closed this as completed 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>
@golang golang locked and limited conversation to collaborators Jan 8, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
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. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants