We use a mocking framework from stretchr in order to mock interfaces for tests. If mocks are used more than once it pays off to generate a mock file with mockery. This is a convenient way because mocking is very repetitive in itself.
mockery with this call (yes, as-is with the dots ans slashes):
$ go get github.com/vektra/mockery/.../
To generate a mock file change into the directory of the interface that you want to mock and call mockery like this:
$ cd directory/to/interface $ mockery -name MyInterface Generating mock for: MyInterface in file: mocks/MyInterface.go $