Go 1.0 compatibility.

This commit is contained in:
Vladimir Mihailenco 2013-12-30 14:29:28 +02:00
parent 10d639d255
commit 75c8dbf91d
2 changed files with 4 additions and 5 deletions

View File

@ -291,7 +291,6 @@ func _parseReply(rd reader, typ replyType) (interface{}, error) {
} }
return vals, nil return vals, nil
} }
default:
return nil, fmt.Errorf("redis: can't parse %q", line)
} }
return nil, fmt.Errorf("redis: can't parse %q", line)
} }

View File

@ -62,7 +62,8 @@ func (c *PubSub) ReceiveTimeout(timeout time.Duration) (interface{}, error) {
return nil, fmt.Errorf("redis: unexpected reply type %T", replyIface) return nil, fmt.Errorf("redis: unexpected reply type %T", replyIface)
} }
switch msgName := reply[0].(string); msgName { msgName := reply[0].(string)
switch msgName {
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe": case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
return &Subscription{ return &Subscription{
Kind: msgName, Kind: msgName,
@ -80,9 +81,8 @@ func (c *PubSub) ReceiveTimeout(timeout time.Duration) (interface{}, error) {
Channel: reply[2].(string), Channel: reply[2].(string),
Payload: reply[3].(string), Payload: reply[3].(string),
}, nil }, nil
default:
return nil, fmt.Errorf("redis: unsupported message name: %q", msgName)
} }
return nil, fmt.Errorf("redis: unsupported message name: %q", msgName)
} }
func (c *PubSub) subscribe(cmd string, channels ...string) error { func (c *PubSub) subscribe(cmd string, channels ...string) error {