From 6ef9e92ffb9db0eeb74c9b22cf58f312a548a021 Mon Sep 17 00:00:00 2001 From: Michael Meier Date: Thu, 1 Jul 2010 01:07:25 +0200 Subject: [PATCH] Make malus compile again --- lib/find.go | 4 ++-- lib/utility.go | 7 +++---- lib/webinterface.go | 5 ++--- main/main.go | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/find.go b/lib/find.go index a33cd78..58cf921 100644 --- a/lib/find.go +++ b/lib/find.go @@ -129,7 +129,7 @@ func find(t string, cm *CallManager, rt RoutingTable, bootstrap *RTHostList) *RT } if kclosest.Len() == 0 { - panicln("nobody to ask...") + panic("nobody to ask...\n") } kclosest.Sort() @@ -148,7 +148,7 @@ func find(t string, cm *CallManager, rt RoutingTable, bootstrap *RTHostList) *RT for converging || finishing { switch { case converging && finishing: - panicln("find logic error") + panic("find logic error\n") case converging: fmt.Printf("find: convering round\n") case finishing: diff --git a/lib/utility.go b/lib/utility.go index 4607970..4a7891a 100644 --- a/lib/utility.go +++ b/lib/utility.go @@ -2,7 +2,6 @@ package malus import ( "crypto/sha1" - "strings" "encoding/hex" ) @@ -32,7 +31,7 @@ func SHA1Bytes(b []byte) string { // Hashes a string and returns a 20 byte string. func SHA1String(s string) string { h := sha1.New() - h.Write(strings.Bytes(s)) + h.Write([]byte(s)) return string(h.Sum()) } @@ -80,7 +79,7 @@ func BucketNo(d Distance) uint { func (a Distance) Less(b Distance) bool { if len(a) != len(b) { - panicln("comparing distances of different lengths") + panic("comparing distances of different lengths\n") } //fmt.Printf("distance Less called: %v < %v\n", a, b) @@ -102,5 +101,5 @@ func (a Distance) Less(b Distance) bool { } func FarthestNode(oid string) string { - return string(XOR(oid, MaxId)) + return string([]byte(XOR(oid, MaxId))) } diff --git a/lib/webinterface.go b/lib/webinterface.go index b036d6f..3bffe03 100644 --- a/lib/webinterface.go +++ b/lib/webinterface.go @@ -3,7 +3,6 @@ package malus import ( "http" - "strings" "fmt" "os" "net" @@ -61,7 +60,7 @@ func (wi *WebInterface) getDummy() (func(*http.Conn, *http.Request)) { fmt.Fprintf(c, "\n") switch req.FormValue("rpc") { case "ping": - c.Write(strings.Bytes("pinging...
")) + c.Write([]byte("pinging...
")) retis, err := wi.cm.Call(raddr, "ping", make([]interface{}, 0)) fmt.Fprintf(c, "=> ping done! err %v retis %v\n", err, retis) case "getsocket": @@ -100,7 +99,7 @@ func (wi *WebInterface) getDummy() (func(*http.Conn, *http.Request)) { fmt.Fprintf(c, "stats: %v
\n", stats) fmt.Fprintf(c, "=> %d kbyte alloc / %d kbyte sys
\n", stats.Alloc / 1024, stats.Sys / 1024) default: - c.Write(strings.Bytes("das esch de rap shit: " + req.FormValue("rpc") + "
ping now!
")) + c.Write([]byte("das esch de rap shit: " + req.FormValue("rpc") + "
ping now!
")) fmt.Fprintf(c, "fuck\n") case "find": wi.find(c, req) diff --git a/main/main.go b/main/main.go index 8b8f85f..4f4c122 100644 --- a/main/main.go +++ b/main/main.go @@ -17,7 +17,7 @@ func main() { laddr, err := net.ResolveUDPAddr("0.0.0.0:7000") if err != nil { - panicln("could not resolve addr") + panic("could not resolve addr\n") } tr := malus.NewUDPTransceiver("udp", laddr) if tr == nil {