fix golint warnings

This commit is contained in:
kevin
2020-08-19 16:00:55 +08:00
parent 2ebb5b6b58
commit 9e14820698
14 changed files with 44 additions and 36 deletions

View File

@@ -60,17 +60,15 @@ func do(name string, execute func(b Breaker) error) error {
lock.RUnlock()
if ok {
return execute(b)
} else {
lock.Lock()
b, ok = breakers[name]
if ok {
lock.Unlock()
return execute(b)
} else {
b = NewBreaker(WithName(name))
breakers[name] = b
lock.Unlock()
return execute(b)
}
}
lock.Lock()
b, ok = breakers[name]
if !ok {
b = NewBreaker(WithName(name))
breakers[name] = b
}
lock.Unlock()
return execute(b)
}