Skip to content

Commit

Permalink
all: update tests to use 'go mod download all' to populate go.sum
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Jay Conrod committed May 11, 2021
1 parent cd1d088 commit be4aaae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/packages/packagestest/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/imports/mod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit be4aaae

Please sign in to comment.