Fix

"fatal error: concurrent map read and map write"

Fix the 'concurrent map read and map write' panic by wrapping all map access with a sync.Mutex or sync.RWMutex.

The error occurs because multiple goroutines are accessing the same map simultaneously without synchronization, with at least one performing a write. Protect the map with a sync.Mutex or sync.RWMutex to ensure only one goroutine accesses it at a time.

var mu sync.Mutex
var data = make(map[string]int)

// Write
mu.Lock()
data[key] = value
mu.Unlock()

// Read
mu.Lock()
val := data[key]
mu.Unlock()