At work, I like to make use of itnerfaces:
- when there may be an entity that has a number of implementations
- to separate layers of our software (high layers have interface fields to backside layers)
- to separate area objects (every area object has its personal interface and often mocks as properly)
I get a whole lot of flack from a colleague that claims this interface overuse is making it arduous for him to comply with my code (to ctrl+click on on code, in his IDE, and get to the area object who causes a given performance), as a result of when he clicks on an interface his IDE takes him to the interface definition and never the interface implementation.
Am I within the flawed right here ? What’s the idiomatic method to do it in Go ? His rule is to have interfaces just for one thing with a number of implementations, or just for mocking exterior programs (for instance, doesn’t permit mocking one other area object in the identical repo)
nterfaces are used to mannequin conduct and outline a contract that an object has to satisfy. They’re helpful for:
- specify the conduct of a specific information sort, however don’t fear about who implements your conduct.
- reap the benefits of a number of inheritances.
- expects unrelated lessons to implement its interface.

