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

Method less

cmp/cmpopts/sort.go:87–95  ·  view source on GitHub ↗
(v reflect.Value, i, j int)

Source from the content-addressed store, hash-verified

85 }
86}
87func (ss sliceSorter) less(v reflect.Value, i, j int) bool {
88 vx, vy := v.Index(i), v.Index(j)
89 vo := ss.fnc.Call([]reflect.Value{vx, vy})[0]
90 if vo.Kind() == reflect.Bool {
91 return vo.Bool()
92 } else {
93 return vo.Int() < 0
94 }
95}
96
97// SortMaps returns a [cmp.Transformer] option that flattens map[K]V types to be
98// a sorted []struct{K, V}. The lessOrCompareFunc function must be either

Callers 3

filterMethod · 0.95
sortMethod · 0.95
checkSortMethod · 0.95

Calls 1

IndexMethod · 0.45

Tested by

no test coverage detected