testing: document that Log and Logf do not usually produce output

The text is printed only if the test fails or -test.v is set.
Document this behavior in the testing package and 'go help test'.
Also put a 'go install' into mkdoc.sh so I don't get tricked by the
process of updating the documentation ever again.

Fixes #5174.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8118047
This commit is contained in:
Rob Pike 2013-04-01 15:17:00 -07:00
parent a23dd4fe4e
commit 144dd2b21c
4 changed files with 9 additions and 4 deletions

View file

@ -246,11 +246,13 @@ func (c *common) log(s string) {
}
// Log formats its arguments using default formatting, analogous to Println,
// and records the text in the error log.
// 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.
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.
// 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.
func (c *common) Logf(format string, args ...interface{}) { c.log(fmt.Sprintf(format, args...)) }
// Error is equivalent to Log followed by Fail.