This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 607
mockgen does not work with type alias #144
Labels
Comments
This is not true. Mockgen reflect mode does work with type alias, and it also support type redeclaration. You can run
|
Ah, I think the problem is with source mode. It's non-obvious why that wouldn't work |
(Well, it is obvious after you remember how source mode works, of course! source mode can't import other packages) |
I think this sounds like a good place for some better docs. |
mockgen does work with alias, but I think only correctly with source mode. This feature request is being tracked in #244. I am going to close this one for now as the other has more active discussion talking place. If there is more to be said, lets say it over there. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
golang 1.9 introduce this type alias feature where you can define type as alias of another type.
There are many different legit use case of that type alias.
The mockgen does not seem to be able to generate mocks for type alias.
For example, If i define Foo as interface, then define Bar as alias of Foo, and I want to generate mock for Bar, it won't work.
The text was updated successfully, but these errors were encountered: