golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

`t.Helper()` equivalent for mocks #628

Open qdm12 opened 2 years ago

qdm12 commented 2 years ago

Requested feature Mark a mock configuration helper function as such so that error traces point back to the call to this mock configuration helping function instead of the call to EXPECT().

Why the feature is needed Error logs will always show the trace pointing to the EXPECT() call even if it is in a shared mock configuration helping function. As far as I have searched, there is no way to mark a 'mock configuration helper function' as such even if using t.Helper().

(Optional) Proposed solution

codyoss commented 2 years ago

I think in order to not change expectations on how people use the library today it would need to be your second or third idea. I would not want to change existing call stacks without more research. I will leave this issue open to see if it gets traction from more in the community.