When running against an empty interface, mockgen is writing out Go files that import the reflect library but don't actually use it causing an unexpected error during test execution:
imported and not used: "reflect"
A rough example input file is:
package tmp
//go:generate mockgen -pkg mocks -destination=../mockgen_tmp.go PACKAGE/tmp EmptyInterfacer
type EmptyInterfacer interface {
// TODO
}
And all matching instances of reflect in the generated file:
I'm having this issue as well.
If this gets fixed it helps with TDD process so that I can start with an empty interface and then add methods to the interface when needed.
When running against an empty interface, mockgen is writing out Go files that import the reflect library but don't actually use it causing an unexpected error during test execution:
A rough example input file is:
And all matching instances of reflect in the generated file:
Adding any placeholder method to this interface makes the error go away.
And thanks for your work on this. It's a nice tool ^_^