diff --git a/client/connection.go b/client/connection.go index 4b04dd5..2202094 100644 --- a/client/connection.go +++ b/client/connection.go @@ -47,7 +47,7 @@ type Conn struct { Timestamp func() *time.Time // Enable debugging? Set format for timestamps on debug output. - Debug bool + Debug bool TSFormat string } @@ -113,7 +113,7 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error { // It's unfortunate that tls.Dial doesn't allow a tls.Config arg, // so we simply replicate it here with the correct Config. // http://codereview.appspot.com/2883041 - if s, err := net.Dial("tcp", "", host); err == nil { + if s, err := net.Dial("tcp", host); err == nil { // Passing nil config => certs are validated. c := tls.Client(s, conn.SSLConfig) if err = c.Handshake(); err == nil { @@ -129,7 +129,7 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error { if !hasPort(host) { host += ":6667" } - if s, err := net.Dial("tcp", "", host); err == nil { + if s, err := net.Dial("tcp", host); err == nil { conn.sock = s } else { return err diff --git a/client/nickchan.go b/client/nickchan.go index 36f7b2c..8d8996e 100644 --- a/client/nickchan.go +++ b/client/nickchan.go @@ -433,23 +433,23 @@ func (n *Nick) String() string { func (cm *ChanMode) String() string { str := "+" a := make([]string, 2) - v := reflect.Indirect(reflect.NewValue(cm)).(*reflect.StructValue) - t := v.Type().(*reflect.StructType) + v := reflect.Indirect(reflect.ValueOf(cm)) + t := v.Type() for i := 0; i < v.NumField(); i++ { - switch f := v.Field(i).(type) { - case *reflect.BoolValue: - if f.Get() { + switch f := v.Field(i); f.Kind() { + case reflect.Bool: + if f.Bool() { str += ChanModeToString[t.Field(i).Name] } - case *reflect.StringValue: - if f.Get() != "" { + case reflect.String: + if f.String() != "" { str += ChanModeToString[t.Field(i).Name] - a[0] = f.Get() + a[0] = f.String() } - case *reflect.IntValue: - if f.Get() != 0 { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if f.Int() != 0 { str += ChanModeToString[t.Field(i).Name] - a[1] = fmt.Sprintf("%d", f.Get()) + a[1] = fmt.Sprintf("%d", f.Int()) } } } @@ -468,13 +468,13 @@ func (cm *ChanMode) String() string { // +iwx func (nm *NickMode) String() string { str := "+" - v := reflect.Indirect(reflect.NewValue(nm)).(*reflect.StructValue) - t := v.Type().(*reflect.StructType) + v := reflect.Indirect(reflect.ValueOf(nm)) + t := v.Type() for i := 0; i < v.NumField(); i++ { - switch f := v.Field(i).(type) { + switch f := v.Field(i); f.Kind() { // only bools here at the mo! - case *reflect.BoolValue: - if f.Get() { + case reflect.Bool: + if f.Bool() { str += NickModeToString[t.Field(i).Name] } } @@ -489,13 +489,13 @@ func (nm *NickMode) String() string { // +o func (p *ChanPrivs) String() string { str := "+" - v := reflect.Indirect(reflect.NewValue(p)).(*reflect.StructValue) - t := v.Type().(*reflect.StructType) + v := reflect.Indirect(reflect.ValueOf(p)) + t := v.Type() for i := 0; i < v.NumField(); i++ { - switch f := v.Field(i).(type) { + switch f := v.Field(i); f.Kind() { // only bools here at the mo too! - case *reflect.BoolValue: - if f.Get() { + case reflect.Bool: + if f.Bool() { str += ChanPrivToString[t.Field(i).Name] } } diff --git a/cmd-google.go b/cmd-google.go index 6e86151..bf850dc 100644 --- a/cmd-google.go +++ b/cmd-google.go @@ -202,7 +202,7 @@ func send(url string) ([]byte, os.Error) { } request.UserAgent = "Mozilla/5.0" - httpcon, err := net.Dial("tcp", "", request.URL.Host + ":" + request.URL.Scheme) + httpcon, err := net.Dial("tcp", request.URL.Host + ":" + request.URL.Scheme) if err != nil { return nil, err } diff --git a/goconfig b/goconfig index eac52d6..9dc97b6 160000 --- a/goconfig +++ b/goconfig @@ -1 +1 @@ -Subproject commit eac52d647ebdf1572a8cb8c81fbdf610f0474112 +Subproject commit 9dc97b6e93e27f30e0cae42094d0e137c697c2ac diff --git a/handler.go b/handler.go index fad19f3..99c14a1 100644 --- a/handler.go +++ b/handler.go @@ -66,7 +66,7 @@ func handlePrivmsg(conn *irc.Conn, line *irc.Line) { fmt.Println("Recovered from", r) callers := make([]uintptr, 10) runtime.Callers(4, callers) - cutoff := runtime.FuncForPC(reflect.NewValue(handlePrivmsg).(*reflect.FuncValue).Get()).Entry() + cutoff := runtime.FuncForPC(reflect.ValueOf(handlePrivmsg).Pointer()).Entry() for _, pc := range callers { function := runtime.FuncForPC(pc - 1) if function.Entry() == cutoff{