Skip to content

Commit be4aaae

Browse files
author
Jay Conrod
committed
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 <[email protected]> Run-TryBot: Jay Conrod <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent cd1d088 commit be4aaae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

go/packages/packagestest/modules.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func (modules) Finalize(exported *Exported) error {
174174
// stuff in cache. All the files created by Export should be recreated.
175175
inv := gocommand.Invocation{
176176
Verb: "mod",
177-
Args: []string{"download"},
177+
Args: []string{"download", "all"},
178178
Env: exported.Config.Env,
179179
BuildFlags: exported.Config.BuildFlags,
180180
WorkingDir: exported.Config.Dir,

internal/imports/mod_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ func setup(t *testing.T, main, wd string) *modTest {
709709
t.Fatalf("checking if go.mod exists: %v", err)
710710
}
711711
if err == nil {
712-
if _, err := env.invokeGo(context.Background(), "mod", "download"); err != nil {
712+
if _, err := env.invokeGo(context.Background(), "mod", "download", "all"); err != nil {
713713
t.Fatal(err)
714714
}
715715
}

0 commit comments

Comments
 (0)