map[reflect.Type][]field cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
(t reflect.Type)
| 1266 | |
| 1267 | // cachedTypeFields is like typeFields but uses a cache to avoid repeated work. |
| 1268 | func cachedTypeFields(t reflect.Type) []field { |
| 1269 | if f, ok := fieldCache.Load(t); ok { |
| 1270 | return f.([]field) |
| 1271 | } |
| 1272 | f, _ := fieldCache.LoadOrStore(t, typeFields(t)) |
| 1273 | return f.([]field) |
| 1274 | } |
no test coverage detected