From 3ba857dfa12c32a0847eb8fdbb1aa849f8c94498 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Mon, 3 Jun 2024 16:44:50 +0100 Subject: [PATCH] race: Fix detected test race in the internal audit code (#19865) --- internal/logger/targets.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/logger/targets.go b/internal/logger/targets.go index a5e9c572c..26f0c7b97 100644 --- a/internal/logger/targets.go +++ b/internal/logger/targets.go @@ -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()