From 8f5f70c7068188be12a52a9173f14f971e19b00b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 8 May 2009 10:14:55 -0700 Subject: minor cleanup, not required by compiler changes R=r DELTA=14 (1 added, 4 deleted, 9 changed) OCL=28447 CL=28509 --- src/lib/http/triv.go | 3 ++- src/lib/net/ip_test.go | 18 +++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/lib/http/triv.go b/src/lib/http/triv.go index c452e2f5c..d2e074d73 100644 --- a/src/lib/http/triv.go +++ b/src/lib/http/triv.go @@ -11,6 +11,7 @@ import ( "fmt"; "http"; "io"; + "log"; "net"; "os"; ) @@ -110,7 +111,7 @@ func main() { http.Handle("/chan", ChanCreate()); err := http.ListenAndServe(":12345", nil); if err != nil { - panic("ListenAndServe: ", err.String()) + log.Crash("ListenAndServe: ", err) } } diff --git a/src/lib/net/ip_test.go b/src/lib/net/ip_test.go index 1626f3156..fb2ae8216 100644 --- a/src/lib/net/ip_test.go +++ b/src/lib/net/ip_test.go @@ -9,11 +9,7 @@ import ( "testing" ) -func ipv4(a, b, c, d byte) []byte { - return []byte{ 0,0,0,0, 0,0,0,0, 0,0,255,255, a,b,c,d } -} - -func isEqual(a []byte, b []byte) bool { +func isEqual(a, b IP) bool { if a == nil && b == nil { return true } @@ -30,18 +26,18 @@ func isEqual(a []byte, b []byte) bool { type parseIPTest struct { in string; - out []byte; + out IP; } var parseiptests = []parseIPTest{ - parseIPTest{"127.0.1.2", ipv4(127, 0, 1, 2)}, - parseIPTest{"127.0.0.1", ipv4(127, 0, 0, 1)}, + parseIPTest{"127.0.1.2", IPv4(127, 0, 1, 2)}, + parseIPTest{"127.0.0.1", IPv4(127, 0, 0, 1)}, parseIPTest{"127.0.0.256", nil}, parseIPTest{"abc", nil}, - parseIPTest{"::ffff:127.0.0.1", ipv4(127, 0, 0, 1)}, + parseIPTest{"::ffff:127.0.0.1", IPv4(127, 0, 0, 1)}, parseIPTest{"2001:4860:0:2001::68", - []byte{0x20,0x01, 0x48,0x60, 0,0, 0x20,0x01, + IP{0x20,0x01, 0x48,0x60, 0,0, 0x20,0x01, 0,0, 0,0, 0,0, 0x00,0x68}}, - parseIPTest{"::ffff:4a7d:1363", ipv4(74, 125, 19, 99)}, + parseIPTest{"::ffff:4a7d:1363", IPv4(74, 125, 19, 99)}, } func TestParseIP(t *testing.T) { -- cgit v1.2.3