-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to implement TODO implement optionalPackageOf for
*model.FuncType
#100
Comments
So, in Added code to the switch statement: case *model.FuncType:
var types = make(map[model.Type]struct{})
for _, inParam := range typedType.In {
types[inParam.Type]= struct{}{}
}
for _, outParam := range typedType.Out {
types[outParam.Type]= struct{}{}
}
if typedType.Variadic != nil {
types[typedType.Variadic.Type]= struct{}{}
}
packages := strings.Builder{}
for t := range types {
if packages.Len() > 0 {
packages.WriteRune('\n')
}
packages.WriteString(optionalPackageOf(t, packageMap))
}
return packages.String() But when generating the matchers it creates a file named:
This closely matches the panic message from the current version of Pegomock:
|
Hi @jpopadak and sorry for the missing functionality :-(. You're on the right track and your implementation above looks right. Check the file for more TODOs and you'll find more functions with switches where Thanks a lot for fixing this! |
We are receiving this TODO while trying to generate some mocks.
Funny thing is, it works for a vararg version of this function, but not a slice version of it.
It works for this:
But does not work for this:
Question:
What does the logic do in
github.com/petergtz/pegomock/mockgen/mockgen.go
functionoptionalPackageOf
? I would like to submit a PR to implement this.The text was updated successfully, but these errors were encountered: