golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

[mockgen] Errors creating mocks for embedded generic interfaces #668

Closed kevinconaway closed 1 year ago

kevinconaway commented 1 year ago

I installed commit 73266f9366fcf2ccef0b880618e5a9266e4136f4 and attempted to generate mocks for an interface that uses both generics and embedded interfaces.

Below is an example:

type Foo[V any] interface {
    Method() V
}

type Bar[V any] interface {
    Foo[V]
    NewMethod() V
}
$ mockgen -source=input.go -destination=input_mockgen.go
2022/08/02 21:35:00 Loading input failed: don't know how to mock method of type *ast.IndexExpr

If I remove the interface embed from Bar the mocks will be generated.

Additional Information

Triage Notes for the Maintainers

codyoss commented 1 year ago

I believe this is a dupe of https://github.com/golang/mock/issues/643.