Calling Unlock in defer ensures it is called even when panicing. Failing to do so will probably cause a deadlock.
sync.RWMutex is conceptually the same thing as a Mutex: it guards access to memory, but RWMutex gives you a little bit more control. You can request a lock for reading, and you will be granted access unless the lock is being held for writing.
Here’s a quick example with a producer that is less active whereas the numerous consumers the code creates.