diff options
Diffstat (limited to 'vendor/github.com/google/go-cmp/cmp/internal/value/sort.go')
-rw-r--r-- | vendor/github.com/google/go-cmp/cmp/internal/value/sort.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go index fe8aa27..938f646 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go | |||
@@ -19,7 +19,7 @@ func SortKeys(vs []reflect.Value) []reflect.Value { | |||
19 | } | 19 | } |
20 | 20 | ||
21 | // Sort the map keys. | 21 | // Sort the map keys. |
22 | sort.Sort(valueSorter(vs)) | 22 | sort.Slice(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) |
23 | 23 | ||
24 | // Deduplicate keys (fails for NaNs). | 24 | // Deduplicate keys (fails for NaNs). |
25 | vs2 := vs[:1] | 25 | vs2 := vs[:1] |
@@ -31,13 +31,6 @@ func SortKeys(vs []reflect.Value) []reflect.Value { | |||
31 | return vs2 | 31 | return vs2 |
32 | } | 32 | } |
33 | 33 | ||
34 | // TODO: Use sort.Slice once Google AppEngine is on Go1.8 or above. | ||
35 | type valueSorter []reflect.Value | ||
36 | |||
37 | func (vs valueSorter) Len() int { return len(vs) } | ||
38 | func (vs valueSorter) Less(i, j int) bool { return isLess(vs[i], vs[j]) } | ||
39 | func (vs valueSorter) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } | ||
40 | |||
41 | // isLess is a generic function for sorting arbitrary map keys. | 34 | // isLess is a generic function for sorting arbitrary map keys. |
42 | // The inputs must be of the same type and must be comparable. | 35 | // The inputs must be of the same type and must be comparable. |
43 | func isLess(x, y reflect.Value) bool { | 36 | func isLess(x, y reflect.Value) bool { |