- Set GOPATH,
export GOPATH=${GOPATH:=$(go env GOPATH)}
- We need mockgen installed,
go get github.com/golang/mock/mockgen
- Verify the binary was installed,
$GOPATH/bin/mockgen
To generate or update Mocks for an interface in a package, use the following command:
make mocks
If you are mocking a new interface for testing, be sure to update the Makefile
target mocks
to include the new interface.
.PHONY: mocks
mocks:
mockgen -destination=pkg/<package path>/mocks/<package name>.go -package=mocks "github.com/aws/eks-anywhere/<package>" <Interface1,Interface2>