-
Notifications
You must be signed in to change notification settings - Fork 109
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
deprecated reflect mode has been replaced with package mode #207
base: main
Are you sure you want to change the base?
Conversation
* generation mocks for generic interfaces * generation mocks for aliases to interfaces * correct names for method arguments
* added detailed parsing error * error more succinct * removed call of iface.Complete() * renamed checkInterfaceIsNotConstraint -> isConstraint * reduced nesting at parse named segment * add_generate_directive test fixed after I accidentally changed it early
# Conflicts: # mockgen/reflect.go
* changed errors formatting with less details * regenerated mocks
* fixed type conversion for support go1.22 * simplified loops by using range * removed unused method "generateSalt" * renamed method of test interface: GiveBirth -> AddHumans
@JacobOaks |
@tulzke - thanks for re-opening this and apologies again for the git mistakes on the other PR. I think for now it makes sense to just use the unaliased names until we're able to update I think the changes to do this aren't too bad, we would just have a separate case in
What are your thoughts? |
I think, that alias for us is the same thing as a
|
So, if we have agreed on the functionality, can we think about the names? What is the name of the new mode to replace reflect? |
I don't have a strong opinion on a name. "package mode" or "types mode" is fine. |
* tests * help message * README.md
I choose package mode. Check last commit changes please: 69210e9 If everything is OK, i'm waiting for a merge 🙂 |
I realized that I had made a mistake. @JacobOaks What do you think about this? //UPD: flags cannot be removed from help, so i added "DEPRECATED" to them usages |
re-open of: #198
resolves #175
resolves #197
resolves #128
It is impossible to create an mock for a generic interface via reflect mode, because it is impossible to compile a generic type without instantiation.
This PR replaces the reflect mod for parsing using go/types.
All exists mocks have been regenerated and the tests have been passed. But since this radically changes the behavior of reflect mode, I would be grateful if there are those who want to add additional test cases that I did not provide.
We can also come up with another name instead of import mode.
benefits:
generation mocks for generic interfaces
generation mocks for aliases to interfaces
correct names for method arguments