Remove duplicate config initialize#1106
Merged
LandonTClipp merged 1 commit intovektra:v3from Aug 19, 2025
Merged
Conversation
Member
|
Thanks for the catch, this seems like it's an easy win. I will also take a look at your other PR in a few days, that seems like a really awesome addition! |
LandonTClipp
approved these changes
Aug 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove duplicate config initialization. Config is already initialized at
NewRootConfig:mockery/config/config.go
Line 212 in 5045e9e
This, caused a big slow down when using
recursive: true. In a repo with 86 packages, here are the difference:Before:
After:
This was found during some tests with #1105, where I'm testing configuring my root package and using recursive to load my whole module. As I load all packages, I can use the comments in the interface to configure mockery instead of managing a config file.
I've noticed it was quite slow and found that we're loading the same packages multiple times because the first time we run
initialize, we load the only configured package and recursively search all the other packages. The second time we runInitialize, we already have all packages list, and try to do a recursive search on each one of them.Type of change
Version of Go used when building/testing:
How Has This Been Tested?
All mocks/tests are still working.
Checklist