-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: explicit '-mod=readonly' argument to go get is not rejected #30345
Comments
This is working as designed; see #26850 (comment). |
Actually, it might not be in the case of |
Yes, I read @rsc's comment before I filed the issue. Even if it were not an explicit Russ's comment does not explain why |
Just re-reading the change of issue title now, it seems that the intended solution is to just not allow a user to pass that flag. I don't see how not listening is going to help the actual use case problem that caused this issue to be raised. |
@kortschak, installing a tool without affecting the main module's The problem here is that The |
Change https://golang.org/cl/198438 mentions this issue: |
@bcmills Riding rough shod is a perfect word for what happened here. Thank you for explaining to me what I meant. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Above is release candidate.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Change directory into a go.mod-containing project with no requirement for "path/to/main".
GO111MODULE=on go get -mod=readonly path/to/main
, where the executable at path/to/main is a tool that I want once and not as a dependency for the project, or I want as a developer and not a user of the project.What did you expect to see?
No change to go.mod file.
What did you see instead?
Addition of "path/to/main" as a requirement in go.mod.
I understand that the docs say that 'The "go get" command remains permitted to update go.mod even with -mod=readonly;. However in this situation there should be some way of not polluting the go.mod just because I happen to be in a module.
The current behaviour is equivalent requiring that I always need to have my car keys on me in the kitchen because at one stage I thought to go and get my car keys when I was in the kitchen, or that a 40lb mallet is required in the kitchen because there was a builder there using one once.
The text was updated successfully, but these errors were encountered: