golang/mock

Source mode fails with embedded interfaces in the same package

joy717 opened this issue · 4 comments

this issue is the same with #178
the sourceFile and the EmbededFile are in the same package but are different files.

even use this command, still got an error:

mockgen -source test2.go -destination test2_mocks.go -package test -aux_files=github.com/anyuser/test=test1.go

I know there is another issue: #85
but #85 is two files in two packages.

gomock version: 1.6.0

It's worked great.
That's my fault.
I'm using go module. the package name in -aux_files was misconfigured

hey, I got the same problem, the command below still not work, how did you solve the problem?

mockgen -source test2.go -destination test2_mocks.go -package test -aux_files=github.com/anyuser/test=test1.go

what did you mean misconfigure package name?

hey, I got the same problem, the command below still not work, how did you solve the problem?

mockgen -source test2.go -destination test2_mocks.go -package test -aux_files=github.com/anyuser/test=test1.go

what did you mean misconfigure package name?

I worte a wrong package name.

-aux_files $PACKAGE_NAME=$REAL_LOCATION_OF_FILE

the $REAL_LOCATION_OF_FILE is based on the path of mocken xxxx command executed.

for example:
if I executed mockgen -source test2.go ... in the location github.com/anyuser/,
-aux_files github.com/anyuser/test=../test1.go

but if I exected mockgen -source test2.go ... in the location github.com/anyuser/test/,
then
-aux_files github.com/anyuser/test=test1.go