mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: switch to proper int64Slice for sorting
This commit is contained in:
parent
5f66b35852
commit
e18b8c12be
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user