Commit 63629d53 authored by Russ Cox's avatar Russ Cox

minor cleanup, not required by compiler changes

R=r
DELTA=14  (1 added, 4 deleted, 9 changed)
OCL=28447
CL=28509
parent b3b3e0da
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"fmt"; "fmt";
"http"; "http";
"io"; "io";
"log";
"net"; "net";
"os"; "os";
) )
...@@ -110,7 +111,7 @@ func main() { ...@@ -110,7 +111,7 @@ func main() {
http.Handle("/chan", ChanCreate()); http.Handle("/chan", ChanCreate());
err := http.ListenAndServe(":12345", nil); err := http.ListenAndServe(":12345", nil);
if err != nil { if err != nil {
panic("ListenAndServe: ", err.String()) log.Crash("ListenAndServe: ", err)
} }
} }
...@@ -9,11 +9,7 @@ import ( ...@@ -9,11 +9,7 @@ import (
"testing" "testing"
) )
func ipv4(a, b, c, d byte) []byte { func isEqual(a, b IP) bool {
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 {
if a == nil && b == nil { if a == nil && b == nil {
return true return true
} }
...@@ -30,18 +26,18 @@ func isEqual(a []byte, b []byte) bool { ...@@ -30,18 +26,18 @@ func isEqual(a []byte, b []byte) bool {
type parseIPTest struct { type parseIPTest struct {
in string; in string;
out []byte; out IP;
} }
var parseiptests = []parseIPTest{ var parseiptests = []parseIPTest{
parseIPTest{"127.0.1.2", ipv4(127, 0, 1, 2)}, parseIPTest{"127.0.1.2", IPv4(127, 0, 1, 2)},
parseIPTest{"127.0.0.1", ipv4(127, 0, 0, 1)}, parseIPTest{"127.0.0.1", IPv4(127, 0, 0, 1)},
parseIPTest{"127.0.0.256", nil}, parseIPTest{"127.0.0.256", nil},
parseIPTest{"abc", 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", 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}}, 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) { func TestParseIP(t *testing.T) {
......
...@@ -22,7 +22,7 @@ func (arr IntArray) Iter() <-chan interface {} { ...@@ -22,7 +22,7 @@ func (arr IntArray) Iter() <-chan interface {} {
return ch return ch
} }
var oneToFive IntArray = []int{ 1, 2, 3, 4, 5 }; var oneToFive = IntArray{ 1, 2, 3, 4, 5 };
func isNegative(n interface {}) bool { func isNegative(n interface {}) bool {
return n.(int) < 0 return n.(int) < 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment