Empty directory created by mock
breml opened this issue · comments
I use moq with the following command line arguments:
moq -pkg mocknotifier -out ../notifier/mocknotifier/notifier.go . Notifier
If the target directory (../notifier/mocknotifier
) already exists, this gets me the generated mock in the file ../notifier/mocknotifier/notifier.go
with the correct package name (mocknotifier
).
But, additionally I get a directory ../mocknotifier
.
If the target directory does not exist, moq
fails with the error message open ../notifier/mocknotifier/notifier.go: no such file or directory
.
It looks like the creation of the target directory in https://github.com/matryer/moq/blob/master/pkg/moq/moq.go#L85 is somehow wrong since e17abc4.
After looking at the code again, the problem becomes obvious: the MkDir
in https://github.com/matryer/moq/blob/master/pkg/moq/moq.go#L85 does not respect the -out
flag.
Also getting this annoying bug. Anyone working on this?