Skip to content

Commit

Permalink
formatting, cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Feb 11, 2015
1 parent a5040ec commit 5602348
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion helper/hashcode/hashcode.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package hashcode

import "hash/crc32"
import (
"hash/crc32"
)

// String hashes a string to a unique hashcode.
//
Expand All @@ -12,5 +14,6 @@ func String(s string) int {
if v < 0 {
return -v
}

return v
}
7 changes: 4 additions & 3 deletions helper/hashcode/hashcode_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package hashcode

import "testing"
import (
"testing"
)

func TestString(t *testing.T) {
v := "hello, world"
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 5602348

Please sign in to comment.