mock_names flag does not change naming of ...Call struct in typed mocks
ojcm opened this issue · 0 comments
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