You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd/go: add -testsum flag to update go.sum in script tests
-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]>
Copy file name to clipboardExpand all lines: src/cmd/go/script_test.go
+81
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ import (
11
11
"bytes"
12
12
"context"
13
13
"errors"
14
+
"flag"
14
15
"fmt"
15
16
"go/build"
16
17
"internal/testenv"
@@ -35,6 +36,8 @@ import (
35
36
"cmd/internal/sys"
36
37
)
37
38
39
+
vartestSum=flag.String("testsum", "", `may be tidy, listm, or listall. If set, TestScript generates a go.sum file at the beginning of each test and updates test files if they pass.`)
40
+
38
41
// TestScript runs the tests in testdata/script/*.txt.
0 commit comments