Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Use of -aux_files causes incorrect generated code in case of embedded interface with package name overlap #691

Open
GillesMoris-NexuzHealth opened this issue Jan 6, 2023 · 0 comments

Comments

@GillesMoris-NexuzHealth
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant