4 ms·
> With Go you have much more limited ability to mock things, so there are added constraints for code to be testable. I agree Go makes things more difficult to
by morelisp 7y ago
> With Go you have much more limited ability to mock things, so there are added constraints for code to be testable.
I agree Go makes things more difficult to mock, but it's also the language I've used where it's easiest to avoid mocks and test the real thing. We have tests for REST and RPC services that... just make a service. There's relatively little boilerplate to make a gRPC or HTTP service with some basic expectations/fake data attached and just run your real client against that real fake server. ("Relatively" meaning, less than the equivalent mocks in Java, for a substantially more realistic test outcome.) And once you have this fake server, it's probably useful in multiple projects, while mock setup tends to be suite- or even case-specific.