Skip to content

Instantly share code, notes, and snippets.

@heppu
Created January 26, 2019 10:05
Show Gist options
  • Save heppu/ab7474e8094e363e43ea98dcd98ad5a0 to your computer and use it in GitHub Desktop.
Save heppu/ab7474e8094e363e43ea98dcd98ad5a0 to your computer and use it in GitHub Desktop.
type Storage interface {
Add(key, val string) error
}
func (s *SafeStorage) Add(key, val string) error {
s.storageMu.Lock()
defer s.storageMu.Unlock()
return s.storage.Add(key, val)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment