Have you ever wanted to fake out go system libary calls? In most cases you create an interface and then provide a mock/fake implementation and a shim that calls the real calls. That’s great if you only have to do it once. What happens when it becomes a pattern and these little utilities end up duplicated everywhere…that’s a problem. This repo is the solution.
how was it made?
As of this commit on maxbrunsfeld/counterfeiter, counterfeiter now has the ability to auto-generate interfaces/shims for system libaries. That’s cool! Instead of generating those on the fly all the time, we collected some popular ones here for your convience.
how to use it?
In your struct for your class add a varible referencing the interface: