Skip to content

Commit a646d4f

Browse files
architectvAleksey Vasyukov
authored and
Aleksey Vasyukov
committed
lamoda#133 | fix data race
1 parent ccdae22 commit a646d4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mocks/service_mock.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type ServiceMock struct {
1212
listener net.Listener
1313
mock *definition
1414
defaultDefinition *definition
15-
sync.Mutex
15+
sync.RWMutex
1616
errors []error
1717

1818
ServiceName string
@@ -85,6 +85,9 @@ func (m *ServiceMock) ResetRunningContext() {
8585
}
8686

8787
func (m *ServiceMock) EndRunningContext() []error {
88+
m.RLock()
89+
defer m.RUnlock()
90+
8891
errs := append(m.errors, m.mock.EndRunningContext()...)
8992
for i, e := range errs {
9093
errs[i] = &Error{

0 commit comments

Comments
 (0)