Actual behavior Using -aux_files when generating a mock for an interface with an embedded interface, combined with overlapping package names and a resulting named import can cause the generated code to use the wrong package name for parameters of the nested interface. Generating without the -aux_files flag does not have the same issue.
Expected behavior No errors in generated code when using -aux_files.
To Reproduce Steps to reproduce the behavior
mockgen_issue.zip
The attached zip contains a minimal reproduction case that is somewhat modeled after how it occurred in our codebase, running the mockgen command in foo.go will generate an invalid mock.
Additional Information
gomock mode (reflect or source): source
gomock version or git ref: v1.6.0
golang version: 1.18
Can be worked around by not using -aux_files or by turning the overlapping package name import into a differently named import as well.
Triage Notes for the Maintainers
Issue regarding -aux_files, which we were using but after retrying without it seems like we might not need it anymore, but as long as it's not deprecated it should still result in correct mock generation.
Actual behavior Using -aux_files when generating a mock for an interface with an embedded interface, combined with overlapping package names and a resulting named import can cause the generated code to use the wrong package name for parameters of the nested interface. Generating without the -aux_files flag does not have the same issue.
Expected behavior No errors in generated code when using -aux_files.
To Reproduce Steps to reproduce the behavior
mockgen_issue.zip The attached zip contains a minimal reproduction case that is somewhat modeled after how it occurred in our codebase, running the mockgen command in
foo.go
will generate an invalid mock.Additional Information
Can be worked around by not using -aux_files or by turning the overlapping package name import into a differently named import as well.
Triage Notes for the Maintainers Issue regarding -aux_files, which we were using but after retrying without it seems like we might not need it anymore, but as long as it's not deprecated it should still result in correct mock generation.