type keyList … func (l keyList) Len() int { … } func (l keyList) Swap(i, j int) { … } func (l keyList) Less(i, j int) bool { … } // keyFloat returns a float value for v if it is a number/bool // and whether it is a number/bool or not. func keyFloat(v reflect.Value) (f float64, ok bool) { … } // numLess returns whether a < b. // a and b must necessarily have the same kind. func numLess(a, b reflect.Value) bool { … }