MCPcopy
hub / github.com/google/go-cmp / checkSort

Method checkSort

cmp/cmpopts/sort.go:156–162  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

154 return dst.Interface()
155}
156func (ms mapSorter) checkSort(v reflect.Value) {
157 for i := 1; i < v.Len(); i++ {
158 if !ms.less(v, i-1, i) {
159 panic(fmt.Sprintf("partial order detected: want %v < %v", v.Index(i-1), v.Index(i)))
160 }
161 }
162}
163func (ms mapSorter) less(v reflect.Value, i, j int) bool {
164 vx, vy := v.Index(i).Field(0), v.Index(j).Field(0)
165 vo := ms.fnc.Call([]reflect.Value{vx, vy})[0]

Callers 1

sortMethod · 0.95

Calls 3

lessMethod · 0.95
LenMethod · 0.65
IndexMethod · 0.45

Tested by

no test coverage detected