Hi everyone, I've been using gomock to generate mock objects (in source mode), and it's been pretty great - way better than maintaining similar code on my own. One thing that I find curious, though, is that expectations are recorded using a generic interface{} type, rather than the original type.
For example, in the sample mock_user.go <https://github.com/golang/mock/blob/master/sample/mock_user/mock_user.go> file, we have: func (_m *MockIndex) Anon(_param0 string) { _m.ctrl.Call(_m, "Anon", _param0) } func (_mr *_MockIndexRecorder) Anon(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "Anon", arg0) } Does anyone know why the Recorder interface is generated with interface{}? Doesn't this mean that we lose type safety when defining expectations? After all, you can do: mock.EXPECT().Anon(123) even though the method must be called with a string parameter, right? Jonathan -- Jonathan Yu / *@jawnsy* on LinkedIn <https://linkedin.com/in/jawnsy>, Twitter <https://twitter.com/jawnsy>, GitHub <https://github.com/jawnsy>, Facebook <https://facebook.com/jawnsy> *“Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”* — Samuel Beckett, Worstward Ho (1983) “In an adaptive environment, winning comes from adapting to change by continuously experimenting and identifying new options more quickly and economically than others. The classical strategist's mantra of sustainable competitive advantage becomes one of serial temporary advantage.” — Navigating the Dozens of Different Strategy Options <https://hbr.org/2015/06/navigating-the-dozens-of-different-strategy-options> (HBR) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.