The best you can hope for is to wrap it in a blank struct like so:
type internalLog struct{}
func (il internalLog) Fatalf(s string, i ...interface{}) {
log.Fatalf(s, i...)
}
In general, since packages are not types in Go, they cannot satisfy anything. You have to wrap them in another type in order to simulate them satisfying an interface.
Edit:
As Caleb mentions (and I forgot about), the package log
in specific has the function New
which returns a *log.Logger which will satisfy the Test
interface in your case (as well as most other package-level log
functions). However, in general if no such type is provided you must wrap the package like I showed above.