-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Handle import name collisions #127
Conversation
Collisions can happen when packages are aliased, in different files, or the local package name conflicts with an import name and a different output package is used.
If the interface to be mocked requires an import that is shadowed by a param with the same name, it's unlikely to be a problem for the upstream interface (and thus go undetected), but it causes moq to generate invalid code. Example in the wild: https://github.com/kubernetes/helm/blob/534193640179fe3c9ffc3012a7bc4e8b23fbe832/pkg/helm/interface.go#L28
So this should supercede #63 too. @sudo-suhas I'm sure you've busy but if you could review this PR it should close a lot of long standing issues. |
I don't know why travis-ci never goes green in GitHub, the build is passing https://travis-ci.org/github/matryer/moq/builds/707403162 |
bump @sudo-suhas any chance you could review this sometime this week? This bug is blocking our usage of the great utility you've created. |
@sudo-suhas Pretty please look at this? I'd really like to continue to use moq, but not getting these things fixed upstream is just becoming too much. I'd rather not fork and am trying my best to do all the heavily lifting here. Please let me know if there is something I can do to help. |
Hey @ibuildthecloud I completely understand and I had even taken a day off with the intention of resolving long standing issues. But I cannot merge any PRs until the Travis CI integration is fixed. I am not the owner so cannot make the necessary changes to the settings. I have requested @matryer's help to sort it out. |
@ibuildthecloud could you rebase this PR? That should trigger the GitHub CI (the Travis CI issue has been resolved). |
@ibuildthecloud thanks for your work on this. |
What is the status of this PR? Its very useful feature |
@ibuildthecloud please rebase so this PR can be merged. I can't wait for this to become available :) |
@cgorenflo Please have a look at #141 and report if this resolves your issue as well. |
@breml Thanks for pointing that out, works like a charm! |
Is it possible to merge this to master? |
This problem might be fixed now? |
Yes, closed via #141. |
Thanks to @ibuildthecloud for this contribution. |
I fixed these issue before I looked to see if an existing PR was in the works, but I thought I'd submit this anyways. This should supercede #120 and #121.
Three cases are handled
not really needed. This just makes the code prettier that is generated.
Using
-pkg bar
you would get a conflict onfoo.Bar
andfoo.Example
Fixes #68
Fixes #94