We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5040ec commit 5602348Copy full SHA for 5602348
2 files changed
helper/hashcode/hashcode.go
@@ -1,6 +1,8 @@
1
package hashcode
2
3
-import "hash/crc32"
+import (
4
+ "hash/crc32"
5
+)
6
7
// String hashes a string to a unique hashcode.
8
//
@@ -12,5 +14,6 @@ func String(s string) int {
12
14
if v < 0 {
13
15
return -v
16
}
17
+
18
return v
19
helper/hashcode/hashcode_test.go
-import "testing"
+ "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"}
20
for _, ip := range ips {
- index := String(ip)
- if index < 0 {
21
+ if index := String(ip); index < 0 {
22
t.Fatalf("Bad Index %#v for ip %s", index, ip)
23
24
0 commit comments