canSortSimply tests whether a reflect.Kind is a primitive that can be sorted directly, or whether it should be considered for sorting by surrogate keys (if the ConfigState allows it).
(kind reflect.Kind)
| 254 | // directly, or whether it should be considered for sorting by surrogate keys |
| 255 | // (if the ConfigState allows it). |
| 256 | func canSortSimply(kind reflect.Kind) bool { |
| 257 | // This switch parallels valueSortLess, except for the default case. |
| 258 | switch kind { |
| 259 | case reflect.Bool: |
| 260 | return true |
| 261 | case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: |
| 262 | return true |
| 263 | case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: |
| 264 | return true |
| 265 | case reflect.Float32, reflect.Float64: |
| 266 | return true |
| 267 | case reflect.String: |
| 268 | return true |
| 269 | case reflect.Uintptr: |
| 270 | return true |
| 271 | case reflect.Array: |
| 272 | return true |
| 273 | } |
| 274 | return false |
| 275 | } |
| 276 | |
| 277 | // Len returns the number of values in the slice. It is part of the |
| 278 | // sort.Interface implementation. |
no outgoing calls
no test coverage detected
searching dependent graphs…