Download:
brew install ifacemaker
orgo install github.com/vburenin/ifacemaker@latest
- Creates interface for some impelentation. now when you add some method, just run go generate ./... and your interface is up to date
- Create implementation for your interface
- generate interface using ifacemaker
-
command:
ifacemaker -f <file> -o <interface_filename> -i <inteface_name> -s <struct_name> -p <package_name>
Download:
go install golang.org/x/tools/cmd/stringer@latest
- Stringer makes your type suitable for fmt.Stringer interface
- create enum for type
- generate String method for type
-
command:
stringer -type=<typename> <filename>
Download:
go install go.uber.org/mock/mockgen@latest
- mockgen allows you to isolate unit of code you are testing by replacing dependencies with contolled substitutes
- Select interface for mocking
- Mock the interface
-
command:
mockgen -source=<filename> -destination=<filename> -package=<pkgname>