golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.3k stars 610 forks source link

difference between source and reflection based output #36

Closed jmhodges closed 4 years ago

jmhodges commented 8 years ago

Just helped a friend who is newer to Go through getting a mock made.

She wanted it for tests in her current package and so used the "reflection" version of the mockgen command to make them. However, that caused a circular dependency error in her own build because her own package was being imported.

Using the -source variation, however, "fixed" the problem.

The -self_package flag fixes this for real, but we couldn't figure that out from the docs immediately.

The "fix" of using -source came to us first, but that was maybe an accident? If it was an accident, then this ticket is for figuring out if the reflection version can figure out that the destination file will be in the same package.

If it wasn't, then maybe I need to come up with a documentation PR.

cyberhck commented 6 years ago

no response here?

balshetzer commented 6 years ago

gomock definitely needs better documentation. I had planned to leave this open until that's resolved.

I'm pretty sure that since this issue was filed gomock has been fixed to handle this specific situation correctly but I can't be sure without sample files.

codyoss commented 4 years ago

Closing this issue for now, as since this issue was opened a lot has changed, including docs. If there are specific things people would like better explained I would like to create smaller targeted issues.