Description
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 on go mod tidy
and go 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 the go.mod
and go.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 updated go.mod
file).
Currently, since -mod=readonly
does not affect go mod tidy
or go mod vendor
, I need to shell out to git diff
to check whether the go.mod
or go.sum
files were altered. I would have expected -mod=readonly
to affect "tidy" and "vendor" in a way such that:
- If the current files on disk are exactly what it would have outputted, it does nothing
- If they would have had to make changes, they would fail with a non-zero error code.
\cc @bcmills