I'm writing a simple library to assist with common assertions.
type Test interface {
Fatalf(string, ...interface{})
}
func IsTrue(statement bool, message string, test Test) {
if !statement {
test.Fatalf(message)
}
}
I noticed that the log
package actually has a compatible implementation of Fatalf(string, ...interface{})
and it'd be great if the IsTrue
method could be invoked accordingly:
IsTrue(false, "false wasn't true", log)
But I get the error use of package log not in selector
. Is there any way to use or wrap a package to make this pattern work or is this not possible?