From cbf9caaf22da04805f1e07277860324c7d9052b6 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 12 Apr 2021 10:41:56 -0400 Subject: [PATCH] cmd/go: add a Go source file in TestScript/mod_sumdb This test expects 'go mod tidy' to fail if the existing module graph has a bad checksum. However, there is no intrinsic reason why 'go mod tidy' should fail in that case: the module contains no packages, and thus no imports, so 'go mod tidy' can justifiably remove all requirements without regard to any errors that may have already been present in the module graph. Adding a source file that imports a package from the module with the bad checksum should guarantee that 'go mod tidy' reports the checksum eror. For #36460 Change-Id: I59734ac524031288bc03a11f58eed5abe2db76b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/309334 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Go Bot Reviewed-by: Jay Conrod --- src/cmd/go/testdata/script/mod_sumdb.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cmd/go/testdata/script/mod_sumdb.txt b/src/cmd/go/testdata/script/mod_sumdb.txt index 9a688e1461..fa3483c5cb 100644 --- a/src/cmd/go/testdata/script/mod_sumdb.txt +++ b/src/cmd/go/testdata/script/mod_sumdb.txt @@ -37,3 +37,9 @@ go get -d rsc.io/fortune -- go.mod.orig -- module m + +go 1.16 +-- m.go -- +package m + +import _ "rsc.io/quote"