This doesn't seem like a go specific issue but an engineering one.
This doesn't seem like a go specific issue but an engineering one.
Java and Python mocking is also a lot more lightweight; you don’t have to generate mocks ahead of using them, regenerate them when the interface changes or work generation into your build process, etc. Richer reflection APIs make it a pretty casual handful of characters to mock something out.
If you're writing tests to improve coverage numbers then maybe you're motivation is wrong.
In most languages with automatic exception propagation you never know what exceptions can be thrown. Is it any different from not testing?
If reliability is critical, having explicit error handling and coverage tools which expose error conditions which haven't been tested is very helpful.
Having to check this in the particular case of every call at every later underlying every handler, does not make my software more reliable in than when it is simply guaranteed in general.
This isn't theoretical. I review a lot of Python code and I would say in over 20% of cases I see a try block with a `finally` longer than two lines, it mistakenly uses a variable that might not be set when an exception is thrown earlier than the writer expected.
You don't need to do this in Go either. Embed the interface type in your mock type. You only need to implement functions that will be called in the function under test.