You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rlh@rlh0:~/work/go/src/log$ go version
go version devel +d6ce3b2 Thu Jun 18 11:35:11 2015 -0400 linux/amd64
rlh@rlh0:~/work/go/src/log$ stress ./log.test -test.v
/tmp/go-stress150315426
=== RUN TestAll
--- PASS: TestAll (0.00s)
=== RUN TestOutput
--- PASS: TestOutput (0.00s)
=== RUN TestFlagAndPrefixSetting
--- PASS: TestFlagAndPrefixSetting (0.00s)
=== RUN TestUTCFlag
--- FAIL: TestUTCFlag (0.00s)
log_test.go:145: got "Test:2015/06/18 16:10:29 hello\n"; want "Test:2015/06/18 16:10:%!d(MISSING) hello\n"
=== RUN TestEmptyPrintCreatesLine
--- PASS: TestEmptyPrintCreatesLine (0.00s)
=== RUN ExampleLogger
--- PASS: ExampleLogger (0.00s)
FAIL
ERROR: exit status 1
5677 runs so far
--- The second fmt.Sprintf looks like it is missing a now.Second()
funcTestUTCFlag(t*testing.T) {
varb bytes.Bufferl:=New(&b, "Test:", LstdFlags)
l.SetFlags(Ldate|Ltime|LUTC)
// Verify a log message looks right in the right time zone. Quantize to the second only.now:=time.Now().UTC()
l.Print("hello")
want:=fmt.Sprintf("Test:%d/%.2d/%.2d %.2d:%.2d:%.2d hello\n",
now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second())
got:=b.String()
ifgot==want {
return
}
// It's possible we crossed a second boundary between getting now and logging,// so add a second and try again. This should very nearly always work.now.Add(time.Second)
want=fmt.Sprintf("Test:%d/%.2d/%.2d %.2d:%.2d:%.2d hello\n",
now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute())
ifgot==want {
return
}
t.Errorf("got %q; want %q", got, want)
}
The text was updated successfully, but these errors were encountered:
--- The second fmt.Sprintf looks like it is missing a now.Second()
The text was updated successfully, but these errors were encountered: