mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-05 05:53:45 +00:00
fix code typo
This commit is contained in:
parent
49d77fb296
commit
a4866e3964
@ -163,9 +163,6 @@ type Memo struct {
|
|||||||
|
|
||||||
// Get is concurrency-safe.
|
// Get is concurrency-safe.
|
||||||
func (memo *Memo) Get(key string) (value interface{}, err error) {
|
func (memo *Memo) Get(key string) (value interface{}, err error) {
|
||||||
res, ok := memo.cache[key]
|
|
||||||
if !ok {
|
|
||||||
res.value, res.err = memo.f(key)
|
|
||||||
memo.cache[key] = res
|
memo.cache[key] = res
|
||||||
memo.mu.Lock()
|
memo.mu.Lock()
|
||||||
res, ok := memo.cache[key]
|
res, ok := memo.cache[key]
|
||||||
|
Loading…
Reference in New Issue
Block a user