diff --git a/internal/proto/writer.go b/internal/proto/writer.go index 38e66c6887..02a588cd01 100644 --- a/internal/proto/writer.go +++ b/internal/proto/writer.go @@ -185,14 +185,20 @@ func (w *Writer) WriteArg(v interface{}) error { return w.int(0) } return w.int(v.Nanoseconds()) + case net.IP: + return w.bytes(v) + case encoding.TextMarshaler: + b, err := v.MarshalText() + if err != nil { + return err + } + return w.bytes(b) case encoding.BinaryMarshaler: b, err := v.MarshalBinary() if err != nil { return err } return w.bytes(b) - case net.IP: - return w.bytes(v) default: return fmt.Errorf( "redis: can't marshal %T (implement encoding.BinaryMarshaler)", v)