diff --git a/example/example.go b/example/example.go index 3adcbb8..312652d 100644 --- a/example/example.go +++ b/example/example.go @@ -2,6 +2,8 @@ package example import "context" +//go:generate moq PersonStore -out mockpersonstore_test.go + type Person struct { ID string Name string diff --git a/package/moq/moq.go b/package/moq/moq.go index 0f9da8a..f1e217f 100644 --- a/package/moq/moq.go +++ b/package/moq/moq.go @@ -78,9 +78,7 @@ func (m *Mocker) Mock(w io.Writer, name ...string) error { method.Returns = extractArgs(sig.Results(), "out%d") } objs = append(objs, obj) - } - } err := m.tmpl.Execute(w, struct{ Objs []*obj }{Objs: objs}) if err != nil { diff --git a/package/moq/moq_test.go b/package/moq/moq_test.go index 6d30489..fb244d7 100644 --- a/package/moq/moq_test.go +++ b/package/moq/moq_test.go @@ -1,16 +1,14 @@ -package moq_test +package moq import ( "bytes" "log" "testing" - - "github.com/matryer/moq/package/moq" ) func TestMoq(t *testing.T) { - m, err := moq.New("../../example") + m, err := New("../../example") if err != nil { t.Errorf("moq.New: %s", err) }