-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
- What version of Go are you using (
go version)?
go version go1.6.2 linux/amd64
Logf's documentation says:
Logf formats its arguments according to the format, analogous to
Printf, 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.
Consider this code:
package test
import (
"testing"
)
func TestLog(t *testing.T) {
t.Logf("text")
t.Logf("text\n")
}
Running the tet case with "go test -v -run TestLog" produces::
=== RUN TestLog
--- PASS: TestLog (0.00s)
log_test.go:8: text
log_test.go:9: text
PASS
ok github.com/yaojingguo/test 0.001s
t.Logf("text") and t.Logf("text\n") produces the same result. So it
can be concluded that Logf appends a new line to a string without
a ending new line. I think that it is better to mention this behavior
in Logf's documentation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.