From 710b9f781e122ad6274e47545c51e06ab0b46097 Mon Sep 17 00:00:00 2001 From: Jacky Date: Mon, 5 May 2025 09:42:11 +0800 Subject: [PATCH] fix(cert): assignment to entry in nil map --- internal/cert/mutex.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/cert/mutex.go b/internal/cert/mutex.go index d24d78d5..c1f406a5 100644 --- a/internal/cert/mutex.go +++ b/internal/cert/mutex.go @@ -10,10 +10,10 @@ var ( mutex sync.Mutex // statusChan is the channel to broadcast certificate status changes - statusChan chan bool + statusChan = make(chan bool, 10) // subscribers is a map of channels that are subscribed to certificate status changes - subscribers map[chan bool]struct{} + subscribers = make(map[chan bool]struct{}) // subscriberMux protects the subscribers map from concurrent access subscriberMux sync.RWMutex @@ -26,10 +26,6 @@ var ( ) func initBroadcastStatus(ctx context.Context) { - // Initialize channels and maps - statusChan = make(chan bool, 10) // Buffer to prevent blocking - subscribers = make(map[chan bool]struct{}) - // Start broadcasting goroutine go broadcastStatus(ctx) }