Implementation using sync.Mutex
Add protectWithMutex