race: Fix detected test race in the internal audit code (#19865)

This commit is contained in:
Anis Eleuch 2024-06-03 16:44:50 +01:00 committed by GitHub
parent a8554c4022
commit 3ba857dfa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 5 deletions

View File

@ -45,16 +45,14 @@ type Target interface {
type targetsList struct {
list []Target
mu *sync.RWMutex
mu sync.RWMutex
}
func newTargetsList() *targetsList {
return &targetsList{
mu: &sync.RWMutex{},
}
return &targetsList{}
}
func (tl targetsList) get() []Target {
func (tl *targetsList) get() []Target {
tl.mu.RLock()
defer tl.mu.RUnlock()