Files
kubesphere/vendor/github.com/jszwec/csvutil/cache_go19.go
2021-03-16 10:27:20 +08:00

19 lines
274 B
Go

// +build go1.9
package csvutil
import (
"sync"
)
var fieldCache sync.Map // map[typeKey][]field
func cachedFields(k typeKey) fields {
if v, ok := fieldCache.Load(k); ok {
return v.(fields)
}
v, _ := fieldCache.LoadOrStore(k, buildFields(k))
return v.(fields)
}