From 9f7e94bcae4eb69fc1312a4aa2f55b4fc396029d Mon Sep 17 00:00:00 2001 From: Mat Ryer Date: Wed, 21 Sep 2016 22:07:00 +0100 Subject: [PATCH] removed extra go generate example --- README.md | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 698b116..64a33c0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Moq is a tool that generates a struct from any interface. The struct can be used In a command line: ``` -moq InterfaceName -out mocks_test.go +moq -out mocks_test.go . MyInterface ``` In code (for go generate): @@ -21,7 +21,7 @@ In code (for go generate): ```go package my -//go:generate moq MyInterface -out myinterface_moq_test.go +//go:generate moq -out myinterface_moq_test.go . MyInterface type MyInterface interface { Method1() error @@ -77,23 +77,6 @@ func CompleteSignUp(to string, sender EmailSender) { The mocked structure implements the interface, where each method calls the associated function field. -### Using go generate - -At the top of the file containing the interface you wish to mock, you can use -`go generate` to specify the interface to mock: - -``` -package test - -//go:generate moq -out myface_test.go . MyFace - -type MyFace interface { - Method() string -} -``` - -Then navigate to the directory in a shell, and run `go generate`. - ## Tips * Keep mocked logic inside the test that is using it