Replies: 3 comments 1 reply
-
|
Thanks for the questions. A lot of our users have complained over the years of really poor performance, and all of this can be traced back to how code generators utilize It's worth noting that you can still use
I'm quite surprised that you find this to be a concern. I've used mockery in large projects as well and I don't find the churn in all: true
recursive: true
packages:
github.com/org/repo:This will simply generate mocks for all interfaces recursively for all packages under the root. It will also generate only a single My main proposition to you is that mockery v3 will reduce the amount of work your developers have to undertake because of its capability to auto-discover interfaces in this manner. Its ability to write all mocks for a package into a single file will likely clean up your repo as well. |
Beta Was this translation helpful? Give feedback.
-
|
I hear you — that’s unfortunate news. We don’t need mocks for all interfaces, and manually specifying packages is not a viable option for us. For now, it seems we’ll have to stick with v2. Hopefully, a more distributed-style solution will emerge that works with go:generate. For example, a command that, based on parameters in the v2 style, generates a temporary config for a specific interface and then runs the main generator with that config. |
Beta Was this translation helpful? Give feedback.
-
|
We've tried different configuration options and eventually settled on this template for old services: all: true
recursive: true
structname: "{{.Mock}}{{.InterfaceName | firstUpper}}"
filename: mock_{{ .InterfaceName | snakecase | lower }}.go
force-file-write: true
template-data:
unroll-variadic: true
packages:
github.com/some-package:The result is about the same as before, only without go:generate and on the new version. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a big fan of mockery. I work at a large company where some teams use uber's mock library, and others use mockery. If the go:generate approach stops working, it will be very difficult for me to keep fighting for mockery for several reasons.
Centralized solutions are always problematic in large projects:
I really hope the go:generate approach remains supported, because otherwise, at least in our case, migrating to v3 won’t be an option.
Beta Was this translation helpful? Give feedback.
All reactions