diff --git a/helper/hashcode/hashcode.go b/helper/hashcode/hashcode.go index 5927b4e7b3..214a2f1e59 100644 --- a/helper/hashcode/hashcode.go +++ b/helper/hashcode/hashcode.go @@ -1,6 +1,8 @@ package hashcode -import "hash/crc32" +import ( + "hash/crc32" +) // String hashes a string to a unique hashcode. // @@ -12,5 +14,6 @@ func String(s string) int { if v < 0 { return -v } + return v } diff --git a/helper/hashcode/hashcode_test.go b/helper/hashcode/hashcode_test.go index 538551ff10..47bc85760e 100644 --- a/helper/hashcode/hashcode_test.go +++ b/helper/hashcode/hashcode_test.go @@ -1,6 +1,8 @@ package hashcode -import "testing" +import ( + "testing" +) func TestString(t *testing.T) { v := "hello, world" @@ -16,8 +18,7 @@ func TestString(t *testing.T) { func TestString_positiveIndex(t *testing.T) { ips := []string{"192.168.1.3", "192.168.1.5"} for _, ip := range ips { - index := String(ip) - if index < 0 { + if index := String(ip); index < 0 { t.Fatalf("Bad Index %#v for ip %s", index, ip) } }