matryer / moq

Interface mocking tool for go generate
http://bit.ly/meetmoq
MIT License
2k stars 127 forks source link

Fix var name generation to avoid conflict #145

Closed sudo-suhas closed 3 years ago

sudo-suhas commented 3 years ago

When the type and the package name is the same for an anonymous parameter (ex: time.Time), and there are more than 1 such parameters, the generated name for both was the same. And the generated code would not be valid.

Fix the bug by ensuring the parameter name does not conflict with package imports first before checking against other parameter names.

Closes #144

cc: @breml

breml commented 3 years ago

Thanks @sudo-suhas, I will give the new release a try later this week.

breml commented 3 years ago

@sudo-suhas Tested the new release successfully, thanks again for the fix.