Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 5602348

Browse files
committed
formatting, cleanups
1 parent a5040ec commit 5602348

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

helper/hashcode/hashcode.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package hashcode
22

3-
import "hash/crc32"
3+
import (
4+
"hash/crc32"
5+
)
46

57
// String hashes a string to a unique hashcode.
68
//
@@ -12,5 +14,6 @@ func String(s string) int {
1214
if v < 0 {
1315
return -v
1416
}
17+
1518
return v
1619
}

helper/hashcode/hashcode_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package hashcode
22

3-
import "testing"
3+
import (
4+
"testing"
5+
)
46

57
func TestString(t *testing.T) {
68
v := "hello, world"
@@ -16,8 +18,7 @@ func TestString(t *testing.T) {
1618
func TestString_positiveIndex(t *testing.T) {
1719
ips := []string{"192.168.1.3", "192.168.1.5"}
1820
for _, ip := range ips {
19-
index := String(ip)
20-
if index < 0 {
21+
if index := String(ip); index < 0 {
2122
t.Fatalf("Bad Index %#v for ip %s", index, ip)
2223
}
2324
}

0 commit comments

Comments
 (0)