From 106ec21d14df07d4c33ec1155328800300c28c7f Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Fri, 18 Mar 2022 15:55:34 +0800 Subject: [PATCH] use RWMutex Signed-off-by: Weizhen Wang --- suite/suite.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/suite/suite.go b/suite/suite.go index 1c835d4e0..1c402e8df 100644 --- a/suite/suite.go +++ b/suite/suite.go @@ -22,15 +22,15 @@ var matchMethod = flag.String("testify.m", "", "regular expression to select tes // retrieving the current *testing.T context. type Suite struct { *assert.Assertions - mu sync.Mutex + mu sync.RWMutex require *require.Assertions t *testing.T } // T retrieves the current *testing.T context. func (suite *Suite) T() *testing.T { - suite.mu.Lock() - defer suite.mu.Unlock() + suite.mu.RLock() + defer suite.mu.RUnlock() return suite.t }