Closed alexbeltran closed 4 years ago
Hi @alexbeltran,
thank you very much for reporting this. I don't have time to look into this right now, but will see if I can address it in the coming days. If you could provide me with some example file/directory structure, that would help to speed things up quite a bit.
Thank you, Peter
@alexbeltran OK, finally had the time to look into this. So here's the issue:
go mod tidy
adds your dependencies' test dependencies to your module. (See https://github.com/golang/go/issues/29323, https://github.com/golang/go/issues/27633, https://github.com/golang/go/issues/26626 and https://github.com/golang/go/issues/26955)
This causes an issue here, because pegomock's own tests depend on a package (i.e. the matchers
package) which itself gets generated as part of the test suite.
I'm not sure I'm excited about the fact go mod tidy
adds test dependencies, because I don't see the use case of running your dependencies' test suites. Any integration test suite requires a certain environment to run anyway, so it's unrealistic to run them.
I guess we could do the following: commit the matchers
package to git and therefore satisfy go mod tidy
. They get temporarily removed by scripts/run_tests.sh
anyway to make sure they get generated properly before the tests run.
Do you think that would solve your problem?
@alexbeltran I just went ahead an made the change on develop
. Could you try and see if that solves your problem?
Thanks for investigating this so qiuckly. Sorry I didn't get back to you immediately.
The develop
branch works for me which is great. :) I also agree, it is strange that go mod tidy would add test dependencies. >.> Including them does fix tidy though.
Okay cool. Will make a release later this week.
When running:
The following is outputted from the generated mock package.
Not clear why it is looking for a matchers library since it isn't in the generated mock package. See imports: