How to assert with a debug message in Go tests?

go

Solution

See: http://golang.org/pkg/testing/#T.Fatal (and Fatalf)

The docs say: "Fatal is equivalent to Log() followed by FailNow()."

Problem

I want to do this: ``` test.FailNow("My Message") ``` but `test.T.FailNow` doesn't take a message. I am currently doing: ``` log.Println("Expected exception but got none") test.FailNow() ``` Is there a better way?

Original source