-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: in tests, populate go.sum files and reduce usage of -mod=mod #41302
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
Comments
Also, |
Change https://golang.org/cl/311189 mentions this issue: |
Change https://golang.org/cl/336150 mentions this issue: |
-testsum may be set to "tidy", "listm", or "listall". When set, TestScript runs 'go mod tidy', 'go list -m -mod=mod all', or 'go list -mod=mod all' at the beginning of each test that has a go.mod file in its root directory. If the test passes and go.mod or go.sum was updated, TestScript will rewrite the test file with the initial content of go.mod and go.sum (after the above command). This is useful for writing tests that need a working go.sum and for fixing tests that rely on -mod=mod. For #41302 Change-Id: I63a5667621a5082ccedfc1bff33c3969c29e8b3d Reviewed-on: https://go-review.googlesource.com/c/go/+/336150 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Jay Conrod <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
Change https://golang.org/cl/341932 mentions this issue: |
-testsum may be set to "tidy", "listm", or "listall". When set, TestScript runs 'go mod tidy', 'go list -m -mod=mod all', or 'go list -mod=mod all' at the beginning of each test that has a go.mod file in its root directory. If the test passes and go.mod or go.sum was updated, TestScript will rewrite the test file with the initial content of go.mod and go.sum (after the above command). This is useful for writing tests that need a working go.sum and for fixing tests that rely on -mod=mod. For #41302 Change-Id: I63a5667621a5082ccedfc1bff33c3969c29e8b3d Reviewed-on: https://go-review.googlesource.com/c/go/+/336150 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Jay Conrod <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/go/+/341932 Reviewed-by: Bryan C. Mills <[email protected]>
This issue acts as a TODO for a number of comments raised in review of CL 251881, which enables
-mod=readonly
by default for #40278. Two broad issues should be fixed in thecmd/go
integration tests.First,
-mod=mod
is used in a lot of places withgo list
orgo build
. We should make the tests follow more idiomatic usage. If something is missing fromgo.mod
orgo.sum
, we should rungo get -d
,go mod tidy
, orgo mod download
first. The following tests need changes. There are probably more.mod_doc
mod_download
.mod_invalid_version
mod_list
mod_load_badzip
mod_replace
mod_replace_gopkgin
mod_require_exclude
mod_sumdb_golang
Second, many tests fail without
-mod=mod
because the test archive doesn't include ago.sum
file. I'd rather not include literalgo.sum
files in tests, since they'll make tests more difficult to write and act as change detectors. Instead, we should have a command or sequence of commands run at the beginning of a test that fills in missing sums without modifyinggo.mod
. Something like:If this turns out to be too repetitive, we may want to add a
script_test.go
command to shorten it.The following tests need changes. Again, there are probably more.
mod_list_dir
mod_list_replace_dir
mod_list_upgrade
mod_load_badmod
mod_modinfo
The text was updated successfully, but these errors were encountered: