From 720d53e65d2f4bc848aaba3d8b9dd1512d0d63ab Mon Sep 17 00:00:00 2001 From: Suhas Karanth Date: Sun, 16 Aug 2020 16:55:11 +0530 Subject: [PATCH] Run go generate Minor changes to generated test file because of c5b1da6 (#128). --- example/mockpersonstore_test.go | 23 ++++++++++------------- generate/generated.go | 33 +++++++++++++++------------------ 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/example/mockpersonstore_test.go b/example/mockpersonstore_test.go index 038cb1b..a82d0a8 100755 --- a/example/mockpersonstore_test.go +++ b/example/mockpersonstore_test.go @@ -8,11 +8,6 @@ import ( "sync" ) -var ( - lockPersonStoreMockCreate sync.RWMutex - lockPersonStoreMockGet sync.RWMutex -) - // Ensure, that PersonStoreMock does implement PersonStore. // If this is not the case, regenerate this file with moq. var _ PersonStore = &PersonStoreMock{} @@ -61,6 +56,8 @@ type PersonStoreMock struct { ID string } } + lockCreate sync.RWMutex + lockGet sync.RWMutex } // Create calls CreateFunc. @@ -77,9 +74,9 @@ func (mock *PersonStoreMock) Create(ctx context.Context, person *Person, confirm Person: person, Confirm: confirm, } - lockPersonStoreMockCreate.Lock() + mock.lockCreate.Lock() mock.calls.Create = append(mock.calls.Create, callInfo) - lockPersonStoreMockCreate.Unlock() + mock.lockCreate.Unlock() return mock.CreateFunc(ctx, person, confirm) } @@ -96,9 +93,9 @@ func (mock *PersonStoreMock) CreateCalls() []struct { Person *Person Confirm bool } - lockPersonStoreMockCreate.RLock() + mock.lockCreate.RLock() calls = mock.calls.Create - lockPersonStoreMockCreate.RUnlock() + mock.lockCreate.RUnlock() return calls } @@ -114,9 +111,9 @@ func (mock *PersonStoreMock) Get(ctx context.Context, id string) (*Person, error Ctx: ctx, ID: id, } - lockPersonStoreMockGet.Lock() + mock.lockGet.Lock() mock.calls.Get = append(mock.calls.Get, callInfo) - lockPersonStoreMockGet.Unlock() + mock.lockGet.Unlock() return mock.GetFunc(ctx, id) } @@ -131,8 +128,8 @@ func (mock *PersonStoreMock) GetCalls() []struct { Ctx context.Context ID string } - lockPersonStoreMockGet.RLock() + mock.lockGet.RLock() calls = mock.calls.Get - lockPersonStoreMockGet.RUnlock() + mock.lockGet.RUnlock() return calls } diff --git a/generate/generated.go b/generate/generated.go index 294820c..04f2ed3 100644 --- a/generate/generated.go +++ b/generate/generated.go @@ -7,12 +7,6 @@ import ( "sync" ) -var ( - lockMyInterfaceMockOne sync.RWMutex - lockMyInterfaceMockThree sync.RWMutex - lockMyInterfaceMockTwo sync.RWMutex -) - // Ensure, that MyInterfaceMock does implement MyInterface. // If this is not the case, regenerate this file with moq. var _ MyInterface = &MyInterfaceMock{} @@ -60,6 +54,9 @@ type MyInterfaceMock struct { Two []struct { } } + lockOne sync.RWMutex + lockThree sync.RWMutex + lockTwo sync.RWMutex } // One calls OneFunc. @@ -69,9 +66,9 @@ func (mock *MyInterfaceMock) One() bool { } callInfo := struct { }{} - lockMyInterfaceMockOne.Lock() + mock.lockOne.Lock() mock.calls.One = append(mock.calls.One, callInfo) - lockMyInterfaceMockOne.Unlock() + mock.lockOne.Unlock() return mock.OneFunc() } @@ -82,9 +79,9 @@ func (mock *MyInterfaceMock) OneCalls() []struct { } { var calls []struct { } - lockMyInterfaceMockOne.RLock() + mock.lockOne.RLock() calls = mock.calls.One - lockMyInterfaceMockOne.RUnlock() + mock.lockOne.RUnlock() return calls } @@ -95,9 +92,9 @@ func (mock *MyInterfaceMock) Three() string { } callInfo := struct { }{} - lockMyInterfaceMockThree.Lock() + mock.lockThree.Lock() mock.calls.Three = append(mock.calls.Three, callInfo) - lockMyInterfaceMockThree.Unlock() + mock.lockThree.Unlock() return mock.ThreeFunc() } @@ -108,9 +105,9 @@ func (mock *MyInterfaceMock) ThreeCalls() []struct { } { var calls []struct { } - lockMyInterfaceMockThree.RLock() + mock.lockThree.RLock() calls = mock.calls.Three - lockMyInterfaceMockThree.RUnlock() + mock.lockThree.RUnlock() return calls } @@ -121,9 +118,9 @@ func (mock *MyInterfaceMock) Two() int { } callInfo := struct { }{} - lockMyInterfaceMockTwo.Lock() + mock.lockTwo.Lock() mock.calls.Two = append(mock.calls.Two, callInfo) - lockMyInterfaceMockTwo.Unlock() + mock.lockTwo.Unlock() return mock.TwoFunc() } @@ -134,8 +131,8 @@ func (mock *MyInterfaceMock) TwoCalls() []struct { } { var calls []struct { } - lockMyInterfaceMockTwo.RLock() + mock.lockTwo.RLock() calls = mock.calls.Two - lockMyInterfaceMockTwo.RUnlock() + mock.lockTwo.RUnlock() return calls }