Code Monkey home page Code Monkey logo

Comments (10)

LandonTClipp avatar LandonTClipp commented on August 24, 2024 1

@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.

LandonTClipp avatar LandonTClipp commented on August 24, 2024

Hello, please provide a reproducer. Without this, I cannot provide any help.

from mockery.

shortsyoungster avatar shortsyoungster commented on August 24, 2024
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.

shortsyoungster avatar shortsyoungster commented on August 24, 2024

I would presume that it has to do with this commit d119c66

from mockery.

shortsyoungster avatar shortsyoungster commented on August 24, 2024

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.

LandonTClipp avatar LandonTClipp commented on August 24, 2024

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.

gurudesu avatar gurudesu commented on August 24, 2024

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.

LandonTClipp avatar LandonTClipp commented on August 24, 2024

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.

gurudesu avatar gurudesu commented on August 24, 2024

Thanks @LandonTClipp! Will try this out and recommend folks in my org to just upgrade 👍

from mockery.

shortsyoungster avatar shortsyoungster commented on August 24, 2024

This worked for me @LandonTClipp. Thank you so much!

from mockery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.