:GoDef: please add support of GoMock
GoMock generates code looks like this:
// GetUsers indicates an expected call of GetUsers.
func (mr *MockClientMockRecorder) GetUsers(ctx, groupID any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsers", reflect.TypeOf((*MockClient)(nil).GetUsers), ctx, groupID)
}
I would love to have a shortcut to teleport me to the original function definition.
Thank you.
You want to jump to the method definition of the method on the interface that the mock is implementing?
Yes.
I'm not sure how that would work. This use case isn't specific to mocks; it's about interface implementations, and any interface implementation could implement one or more interfaces. Which interface would it jump to?
But if we have only one implementation?
If multiple - as always - show a list of them?
Now it looks like missing of the base functionality - I see mock calling in my test - and no way to jump to the real function.
The way I asked my question was ambiguous. Do you want to jump to the definition on the method on the other implementation of the interface instead of the mock or do you want to jump to the declaration of the method on the interface that the mock implements? And where would the start point be? Would it be expected to be only on recorder methods (i.e. those that return a *gomock.Call)?
Do you want to jump to the definition on the method on the other implementation of the interface instead of the mock
Yes, it feels like a basic functionality - ability to jump to a method that we test, not to the mock generated code that is always the same - by default we should not jump to the mock code.
do you want to jump to the declaration of the method on the interface that the mock implements?
No, there is no info in that - this is the signature only.
I don't intend to implement this, because the type you want to jump from is not the type that implements the interface. You're trying to jump from the recorder, not the mock itself. To implement this as requested on the recorder would have very limited utility and would be entirely dependent on the implementation of gomock. Please correct me if I'm misunderstanding what you're asking for.
No, there is no info in that - this is the signature only.
The signature is on the interface. It would actually be the easiest to jump to. Finding the interface implementation and jumping to it is more difficult.