aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2021-05-11 11:39:06 -0400
committerJay Conrod <jayconrod@google.com>2021-05-11 20:42:14 +0000
commitbe4aaae4cf865bd1e65ae3a22df28c1f47b6ccfd (patch)
treeffd560c90469a9e2b58a2ac201ca1d32d3a02c81
parentcd1d0887dc8cfcfb844340a5fce628c61da00a20 (diff)
downloadgolang-x-tools-be4aaae4cf865bd1e65ae3a22df28c1f47b6ccfd.tar.gz
all: update tests to use 'go mod download all' to populate go.sum
In anticipation of CL 318629, 'go mod download' without arguments will not update go.mod or go.sum. Before 1.16, 'go mod download' would adds sums for .mod files but not .zip files (which people didn't usually notice). Many folks found the behavior of adding sums for .zip files to be annoying. This change alters tests to run 'go mod download all' to populate go.sum files. This is equivalent to 'go mod download' without arguments before CL 318629. For golang/go#45332 Change-Id: I387d514176f798ae8f17b0b056194196718f57f5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/318811 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
-rw-r--r--go/packages/packagestest/modules.go2
-rw-r--r--internal/imports/mod_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/go/packages/packagestest/modules.go b/go/packages/packagestest/modules.go
index 42b62067a..2c4356747 100644
--- a/go/packages/packagestest/modules.go
+++ b/go/packages/packagestest/modules.go
@@ -174,7 +174,7 @@ func (modules) Finalize(exported *Exported) error {
// stuff in cache. All the files created by Export should be recreated.
inv := gocommand.Invocation{
Verb: "mod",
- Args: []string{"download"},
+ Args: []string{"download", "all"},
Env: exported.Config.Env,
BuildFlags: exported.Config.BuildFlags,
WorkingDir: exported.Config.Dir,
diff --git a/internal/imports/mod_test.go b/internal/imports/mod_test.go
index 91863efac..51bc96791 100644
--- a/internal/imports/mod_test.go
+++ b/internal/imports/mod_test.go
@@ -709,7 +709,7 @@ func setup(t *testing.T, main, wd string) *modTest {
t.Fatalf("checking if go.mod exists: %v", err)
}
if err == nil {
- if _, err := env.invokeGo(context.Background(), "mod", "download"); err != nil {
+ if _, err := env.invokeGo(context.Background(), "mod", "download", "all"); err != nil {
t.Fatal(err)
}
}