Open jtyers opened 4 years ago
@jtyers Can you please share the versions were this both did and did not work(mockgen)?
@codyoss sorry, here it is:
go: found github.com/golang/mock/mockgen in github.com/golang/mock v1.4.3
go: downloading golang.org/x/tools v0.0.0-20190425150028-36563e24a262
To be clear I'm not aware of this ever working in mockgen. My reference to "tests failing where they didn't before" is that in the old version of my code, I used map[string]interface{}
and in the new version, M
.
Also of interest may be that if I change the signature to DoSomething(input M)
the test stlil fails.
Thank you for all the information that helps! Yes is seems like our type checking might be too strict. My guess with out looking at the code is we need to add some reflect checks around if the type is assignable. I would be glad to accept a PR for such a feature 😸
If I derive a type from a core type and use that in my expectations, tests start failing where they didn't before, even where the inputs have not changed. I've only tested this with a
map
.Below is a complete working test that shows a given input working when I pass a
map
to the EXPECT (and mock), and then when I pass anM{}
. The inputs stay the same, but the second test fails.Additional Information Golang 1.14.1