Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 7, 2023
1 parent 231ec67 commit 90986c1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ type _storage map[*cobra.Command]*entry

var storageMutex sync.RWMutex

func (s _storage) get(cmd *cobra.Command) (e *entry) {
func (s _storage) get(cmd *cobra.Command) *entry {
storageMutex.RLock()
e, ok := s[cmd]
storageMutex.RUnlock()

var ok bool
if e, ok = s[cmd]; !ok {
storageMutex.RUnlock()
if !ok {
storageMutex.Lock()
defer storageMutex.Unlock()
e = &entry{}
s[cmd] = e
} else {
storageMutex.RUnlock()
}
return
return e
}

var bridgeMutex sync.Mutex
Expand Down

0 comments on commit 90986c1

Please sign in to comment.