From 94b1898ec699eab91498740e69488d8922098028 Mon Sep 17 00:00:00 2001 From: Menno Pruijssers Date: Mon, 19 Dec 2016 16:30:08 +0100 Subject: [PATCH] re-format --- hashring/hashring.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hashring/hashring.go b/hashring/hashring.go index 48c5319b..42930ca7 100644 --- a/hashring/hashring.go +++ b/hashring/hashring.go @@ -61,16 +61,19 @@ type replicaPoint struct { func (r replicaPoint) Compare(other interface{}) (result int) { o := other.(replicaPoint) + result = r.hash - o.hash - if result == 0 { - result = strings.Compare(r.address, o.address) + if result != 0 { + return } - if result == 0 { - result = r.index - o.index + result = strings.Compare(r.address, o.address) + if result != 0 { + return } - return result + result = r.index - o.index + return } // HashRing stores strings on a consistent hash ring. HashRing internally uses