Comments (10)
@shortsyoungster @gurudesu I found the issue and submitted a PR to fix it. If the tests pass I will merge and tag the fix.
Sorry for the delay in getting to this. @gurudesu after you told me you were telling people to use gomock I knew I wouldn't be able to sleep until my competition is crushed, so I hope this fixes your issue 😅
This bug actually had nothing to do with the variadic-ness of the function (although I did find a separate bug that I don't think was part of the original complaint here). It was failing on the return value of the function argument. Details in the linked PR.
PS I guess a way to get me to do stuff is to just say gomock does something better. That should never be the case in my opinion!
from mockery.
Hello, please provide a reproducer. Without this, I cannot provide any help.
from mockery.
type MyNewInterface interface {
FetchData(
ctx context.Context,
dataType reflect.Type,
fetchFunc func(xxx ...yyy.ZZ) ([]aa.BB, error),
) ([]aa.BB, error)
}
This worked on Mockery v2.20.2
from mockery.
I would presume that it has to do with this commit d119c66
from mockery.
I have tested on v2.40.0, and everything works, this is the version right before d119c66 so I am fairly confident that it is the cause.
from mockery.
I think the thing to do here is add your example interface as a fixture and have mockery generate it within this project (mainly for testing/backwards compat reasons), then figure out precisely why this fails. Variadic argument have been the bane of my existence in this project, so I'm guessing we'll need yet another special exception for whatever is going wrong here.
from mockery.
I'm experiencing the same issues here - especially with trying to mock the AWS SDK Go V2 interfaces. As an example, see this struct.
Not a bash on this project (thank you for supporting this) but for the time being we've been pushing folks to use gomock instead since they seem to handle variadic arguments well.
from mockery.
I'll do what I can to fix this, if anyone would be able to submit a PR that would be great, I probably can't get to it for the next few weeks due to being busy at work.
I hope to not drive people away to the main competition for this project, that irks me :)
from mockery.
Thanks @LandonTClipp! Will try this out and recommend folks in my org to just upgrade 👍
from mockery.
This worked for me @LandonTClipp. Thank you so much!
from mockery.
Related Issues (20)
- Logging warning when mock config is orphaned HOT 1
- Files being created even with `dry-run: true` HOT 1
- Discussion: is interface just for mocking a good idea? HOT 1
- Configuration option `inpackage` is not functioning as expected HOT 3
- Incorrect mocks generated when there are multiple interfaces in the same package HOT 6
- Indirect dependency from go-viper includes critical vulnerability CVE-2021-28235
- Using exclude on windows throws an error because of path separator being used, I have raised a PR HOT 1
- Initialize/setup mock via a constructor param HOT 3
- `disable-version-string` not respected in packages config HOT 7
- Unable to generate interface type from another interface HOT 15
- Feature request: pre-commit hooks HOT 8
- Support empty `.mockery.yaml` config HOT 1
- Allow for No Return Value on Generated Mocks
- arg package name collision within generated mock HOT 2
- mockname with problem HOT 1
- mock generation for non-relative-to-interface dirs HOT 2
- Go 1.23: Mock generation fails with alias types HOT 5
- Mocked Generated Classes using internal package HOT 4
- Same name imports with numbers in the directory structure generates invalid imports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockery.