counterfeiter icon indicating copy to clipboard operation
counterfeiter copied to clipboard

Avoid fast-failing on unresolved imports that aren't used in the target interface

Open FastNav opened this issue 3 years ago • 0 comments

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.

FastNav avatar Jun 20 '21 19:06 FastNav