feat(mockgen): respect custom function implementations #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this change, a user of mockgen was free to include any function declarations that they wished, but it was possible that they collided with generated functions, leading to a broken build.
This change performs a scan of the existing packages for any colliding function names or functions that already provide the call to mock.Expect. We naively assume that the result of the mock.Expect call is returned from the user defined function. If there is more than one call to a mock.Expect function within a single custom function then we ignore the custom function and generate functions as per normal. If there is a function that collides with a generated function name but does not make a call to a mock.Expect function then the generated function falls back to a more verbose name.