-
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: readonly does not affect all go mod sub-commands #26850
Comments
@gopherbot please add modules label |
Nice approach. Switches to using that in CI
Just to confirm, you're using this as a step to check that the committed state of i.e. it's independent to the step of (Just a side question; |
This is working as documented. From
The idea is that you can set GOFLAGS=-mod=readonly In any event, it's very clear that these commands don't pay attention
I think this is working the right way. You could use 'go list all -mod=readonly' to check that at least for the current GOOS/GOARCH no changes are needed. |
Could we not? It could also serve as a fix for #27643 - for people that don't like having implicit changes to their go.mod, they could just set GOFLAGS=-mod=readonly and go on about their business. I think it would be useful to have a flag to tell tidy to just report if it would change the go.mod without doing so. I don't think telling people to use |
I think the crux of this issue is covered by #27005, hence I'm going to close this. If someone feels like we need to keep this issue open for |
Over in #31372, I have another use case for this issue. Specifically |
@myitcv Based on my comment above, would you be willing to reopen this issue? |
@jsha - I would raise a new issue. Apologies, I'm fairly out the loop on all this stuff, but as a rule closed issues don't get many eyes looking at them. |
Using
go.11beta3
In https://golang.org/cl/127916, I'm working a
test.bash
script that is intended to be used a pre-submit and post-submit hook. In that script, I rely ongo mod tidy
andgo mod vendor
to manage dependencies (I use "vendor" so that I can use the same set of dependencies when testing with Go1.9 and Go1.10).One of the properties of the
test.bash
script is the ability to detect when thego.mod
andgo.sum
files are out of sync with the source code (e.g., a user submitted code that changed the dependency tree but forgot to also submit the updatedgo.mod
file).Currently, since
-mod=readonly
does not affectgo mod tidy
orgo mod vendor
, I need to shell out togit diff
to check whether thego.mod
orgo.sum
files were altered. I would have expected-mod=readonly
to affect "tidy" and "vendor" in a way such that:\cc @bcmills
The text was updated successfully, but these errors were encountered: