-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to generate mock for package using alternate major version and generic type with reflect mode #97
Comments
I have a potential fix here: #98, but needs more time to investigate and understand the root cause. |
I think it's kind of related to this: golang/go#54393 |
@bcho Your mockgen is not the latest version. Please run |
Hi, I think the problem is reflect mode does not support generating generic type. The issue is reporting the reflect mode usage. I understand the latest main branch has deprecated the reflect mode. Your suggestion is for switching to a different mode, which will require some additional update on the command due to legacy usages. Will close this issue since there is no way to implement this feature under reflect mode. |
Actual behavior
mockgen generates a uncompilable mock file for interface using alternate major version package and generic types.
Here is a reproduce:
Above program fails the mockgen with error like this (full output):
You can find the full repro here: https://github.com/bahe-msft/mockgen-repro
Expected behavior
Generated mock file should be a valid go source. Expected output: https://github.com/bahe-msft/mockgen-repro/blob/main/mock_main/foo.go
To Reproduce Steps to reproduce the behavior
go generate -v ...
Additional Information
The same mock can be generated using source mode. But our project is using reflect mode heavily, so we want to fix in reflect mode as well.
Triage Notes for the Maintainers
The text was updated successfully, but these errors were encountered: