uber-go / mock

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

mock_names flag does not change naming of ...Call struct in typed mocks #117

Open ojcm opened 8 months ago

ojcm commented 8 months ago

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

Triage Notes for the Maintainers