From e18b8c12befe9e6551de680a713df2f044ff8b9a Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Thu, 11 Sep 2014 17:28:08 -0700 Subject: [PATCH] etcdserver: switch to proper int64Slice for sorting --- etcdserver/etcdhttp/peers_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/etcdserver/etcdhttp/peers_test.go b/etcdserver/etcdhttp/peers_test.go index e82c727e2..e3433ac7e 100644 --- a/etcdserver/etcdhttp/peers_test.go +++ b/etcdserver/etcdhttp/peers_test.go @@ -63,14 +63,20 @@ func TestPeers(t *testing.T) { } } +type int64Slice []int64 + +func (p int64Slice) Len() int { return len(p) } +func (p int64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + func sortint64(list []int64) { - sorted := make(sort.IntSlice, len(list)) + sorted := make(int64Slice, len(list)) for i, j := range list { - sorted[i] = int(j) + sorted[i] = j } - sorted.Sort() + sort.Sort(sorted) for i, j := range sorted { - list[i] = int64(j) + list[i] = j } }