aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2015-05-06 13:19:30 -0700
committerRob Pike <r@golang.org>2015-05-06 20:59:36 +0000
commite9827f62018b87482e647dd88aecdedb24c94680 (patch)
treefdd56fb367dd635b7774bce321f9c6c1df719e1e /src/testing/testing.go
parent17db6e042066e167f38513c06509c5043dcad002 (diff)
downloadgo-e9827f62018b87482e647dd88aecdedb24c94680.tar.xz
testing: document that Log and Logf always print in benchmarks
Fixes #10713. Change-Id: Ifdafc340ae3bba751236f0482246c568346a569c Reviewed-on: https://go-review.googlesource.com/9763 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 51631238aa..280d76a1aa 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -342,13 +342,15 @@ func (c *common) log(s string) {
}
// Log formats its arguments using default formatting, analogous to Println,
-// and records the text in the error log. The text will be printed only if
-// the test fails or the -test.v flag is set.
+// and records the text in the error log. For tests, the text will be printed only if
+// the test fails or the -test.v flag is set. For benchmarks, the text is always
+// printed to avoid having performance depend on the value of the -test.v flag.
func (c *common) Log(args ...interface{}) { c.log(fmt.Sprintln(args...)) }
// Logf formats its arguments according to the format, analogous to Printf,
-// and records the text in the error log. The text will be printed only if
-// the test fails or the -test.v flag is set.
+// and records the text in the error log. For tests, the text will be printed only if
+// the test fails or the -test.v flag is set. For benchmarks, the text is always
+// printed to avoid having performance depend on the value of the -test.v flag.
func (c *common) Logf(format string, args ...interface{}) { c.log(fmt.Sprintf(format, args...)) }
// Error is equivalent to Log followed by Fail.