counterfeiter
counterfeiter copied to clipboard
Avoid fast-failing on unresolved imports that aren't used in the target interface
For example, the mock generator should still operate on a file like this:
package example
import (
nonexistent "fake.com/this/package/doesnt/exist"
)
type Fooer interface {
SayHello(audience string) string
}
func ProcessFooer(f Fooer) nonexistent.Report {
return nonexistent.NewReport().WithFooer(f)
}
This is useful for tooling (namely Bazel tooling) that can be optimized to run Counterfeiter on a generated GOPATH
that only includes strictly useful dependencies of an API. Such optimizations currently cause Counterfeiter to crash due to unresolved import errors.