mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-24 07:14:47 +00:00
代码格式fix
This commit is contained in:
parent
caa6653b3d
commit
9eb16a52f2
@ -163,12 +163,13 @@ type Memo struct {
|
||||
|
||||
// Get is concurrency-safe.
|
||||
func (memo *Memo) Get(key string) (value interface{}, err error) {
|
||||
res, ok := memo.cache[key] if!ok{
|
||||
res, ok := memo.cache[key]
|
||||
if !ok {
|
||||
res.value, res.err = memo.f(key)
|
||||
memo.cache[key] = res
|
||||
memo.mu.Lock()
|
||||
res, ok := memo.cache[key]
|
||||
if !ok {
|
||||
if !ok {
|
||||
res.value, res.err = memo.f(key)
|
||||
memo.cache[key] = res
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user