You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actual behavior
Using -mock_names option does not alter the name of ...Call structs.
e.g. mockgen -typed=true -mock_names=Writer=OtherWriter io Writer generates
// WriterWriteCall wrap *gomock.Call
type WriterWriteCall struct {
*gomock.Call
}
This causes problems if using -mock_names to avoid clashes between mocks for interfaces with the same name (e.g. if I have my own Writer interface and also want to mock io.Writer in the same package) since there will be multiple structs with the same type name in the same package.
Expected behavior
I expect using -mock_names option to change the name of ...Call structs.
e.g. mockgen -typed=true -mock_names=Writer=OtherWriter io Writer generates
// OtherWriterWriteCall wrap *gomock.Call
type OtherWriterWriteCall struct {
*gomock.Call
}
To Reproduce
Run mockgen -typed=true -mock_names=Writer=OtherWriter io Writer
Additional Information
gomock mode (reflect or source): both
gomock version or git ref: v0.3.0
golang version: 1.21.3
Triage Notes for the Maintainers
The text was updated successfully, but these errors were encountered:
When you are trying to mock multiple interfaces with the same name and
similar methods (for example user.Service Create, post.Service Create,
etc..) there is collision in Recorder and ReturnCall types, the
-mockNames parameter only changes the main interface name, with the
changes proposed in this PR the correct mockName will be applied to the
Recorder and ReturnCall types.
Addresses #117
Actual behavior
Using
-mock_names
option does not alter the name of...Call
structs.e.g.
mockgen -typed=true -mock_names=Writer=OtherWriter io Writer
generatesThis causes problems if using
-mock_names
to avoid clashes between mocks for interfaces with the same name (e.g. if I have my ownWriter
interface and also want to mockio.Writer
in the same package) since there will be multiple structs with the same type name in the same package.Expected behavior
I expect using
-mock_names
option to change the name of...Call
structs.e.g.
mockgen -typed=true -mock_names=Writer=OtherWriter io Writer
generatesTo Reproduce
Run
mockgen -typed=true -mock_names=Writer=OtherWriter io Writer
Additional Information
Triage Notes for the Maintainers
The text was updated successfully, but these errors were encountered: