From 709317138fb75724ff229f4a61a5c76a9003fdf0 Mon Sep 17 00:00:00 2001 From: Jean de Klerk Date: Tue, 20 Feb 2018 17:26:57 -0800 Subject: [PATCH] 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 Reviewed-by: Rob Pike --- src/cmd/go/alldocs.go | 6 ++++++ src/cmd/go/internal/test/test.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 2788a9eef6..d78a08821e 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1738,6 +1738,12 @@ // the package list would have to appear before -myflag, but could appear // on either side of -v. // +// When 'go test' runs in package list mode, 'go test' caches successful +// package test results to avoid unnecessary repeated running of tests. To +// disable test caching, use any test flag or argument other than the +// cacheable flags. The idiomatic way to disable test caching explicitly +// is to use -count=1. +// // To keep an argument for a test binary from being interpreted as a // known flag or a package name, use -args (see 'go help test') which // passes the remainder of the command line through to the test binary diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 0a440585cb..9a53a19731 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -385,6 +385,12 @@ flag not known to the go test command. Continuing the example above, the package list would have to appear before -myflag, but could appear on either side of -v. +When 'go test' runs in package list mode, 'go test' caches successful +package test results to avoid unnecessary repeated running of tests. To +disable test caching, use any test flag or argument other than the +cacheable flags. The idiomatic way to disable test caching explicitly +is to use -count=1. + To keep an argument for a test binary from being interpreted as a known flag or a package name, use -args (see 'go help test') which passes the remainder of the command line through to the test binary -- 2.48.1