Skip to content

Commit 7093171

Browse files
jeanbzarobpike
authored andcommitted
cmd/go: briefly document test caching in go test -h output
Fixes #23971 Change-Id: I073f278cc058aa15a23c0ea06292c02d50a3df21 Reviewed-on: https://go-review.googlesource.com/95582 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent cde3478 commit 7093171

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/cmd/go/alldocs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,12 @@
17381738
// the package list would have to appear before -myflag, but could appear
17391739
// on either side of -v.
17401740
//
1741+
// When 'go test' runs in package list mode, 'go test' caches successful
1742+
// package test results to avoid unnecessary repeated running of tests. To
1743+
// disable test caching, use any test flag or argument other than the
1744+
// cacheable flags. The idiomatic way to disable test caching explicitly
1745+
// is to use -count=1.
1746+
//
17411747
// To keep an argument for a test binary from being interpreted as a
17421748
// known flag or a package name, use -args (see 'go help test') which
17431749
// passes the remainder of the command line through to the test binary

src/cmd/go/internal/test/test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ flag not known to the go test command. Continuing the example above,
385385
the package list would have to appear before -myflag, but could appear
386386
on either side of -v.
387387
388+
When 'go test' runs in package list mode, 'go test' caches successful
389+
package test results to avoid unnecessary repeated running of tests. To
390+
disable test caching, use any test flag or argument other than the
391+
cacheable flags. The idiomatic way to disable test caching explicitly
392+
is to use -count=1.
393+
388394
To keep an argument for a test binary from being interpreted as a
389395
known flag or a package name, use -args (see 'go help test') which
390396
passes the remainder of the command line through to the test binary

0 commit comments

Comments
 (0)