Skip to content

Commit

Permalink
util: clean up MemoizeStr function (pingcap#11450)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaut authored and zz-jason committed Jul 26, 2019
1 parent 85c790e commit e220499
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions util/stringutil/string_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,8 @@ func (l stringerFunc) String() string {

// MemoizeStr returns memoized version of stringFunc.
func MemoizeStr(l func() string) fmt.Stringer {
var result string
return stringerFunc(func() string {
if result != "" {
return result
}
result = l()
return result
return l()
})
}

Expand Down

0 comments on commit e220499

Please sign in to comment.