JSON output doesn't help. There's no indication there either that a certain 
message is a test failure. That's because t.Error = t.Log + t.Fail. 
Attached is an example.

Bye,  Patrick

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bd27010a-7f48-4e21-9fc5-c8ca2666d03en%40googlegroups.com.
$ cat test/test_test.go
package test

import "testing"

func TestLog(t *testing.T) {
        t.Log("Hello world!")
        t.Error("Huh, what's this?")
}

$ go test ./test
--- FAIL: TestLog (0.00s)
    test_test.go:6: Hello world!
    test_test.go:7: Huh, what's this?
FAIL
FAIL    k8s.io/kubernetes/test  0.003s
FAIL

$ go test -json ./test
{"Time":"2023-03-10T08:19:24.595561773+01:00","Action":"run","Package":"k8s.io/kubernetes/test","Test":"TestLog"}
{"Time":"2023-03-10T08:19:24.595722808+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Test":"TestLog","Output":"===
 RUN   TestLog\n"}
{"Time":"2023-03-10T08:19:24.595743855+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Test":"TestLog","Output":"
    test_test.go:6: Hello world!\n"}
{"Time":"2023-03-10T08:19:24.59575475+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Test":"TestLog","Output":"
    test_test.go:7: Huh, what's this?\n"}
{"Time":"2023-03-10T08:19:24.595791388+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Test":"TestLog","Output":"---
 FAIL: TestLog (0.00s)\n"}
{"Time":"2023-03-10T08:19:24.59580443+01:00","Action":"fail","Package":"k8s.io/kubernetes/test","Test":"TestLog","Elapsed":0}
{"Time":"2023-03-10T08:19:24.595817364+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Output":"FAIL\n"}
{"Time":"2023-03-10T08:19:24.595975533+01:00","Action":"output","Package":"k8s.io/kubernetes/test","Output":"FAIL\tk8s.io/kubernetes/test\t0.003s\n"}
{"Time":"2023-03-10T08:19:24.596021059+01:00","Action":"fail","Package":"k8s.io/kubernetes/test","Elapsed":0.003}

Reply via email to