Commit 1a46aecc authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Kamil Kisiel

encoder: Don't repeat casting to Tuple if it is already Tuple

Fix my mistake from f98f54b1 (encoder/decoder: Teach ogórek about
tuple) by avoiding computing/asserting the same thing twice that was
just computed/asserted.
parent ea04619f
......@@ -138,8 +138,8 @@ func (e *Encoder) encode(rv reflect.Value) error {
case reflect.Array, reflect.Slice:
if rv.Type().Elem().Kind() == reflect.Uint8 {
return e.encodeByteArray(rv.Bytes())
} else if _, ok := rv.Interface().(Tuple); ok {
return e.encodeTuple(rv.Interface().(Tuple))
} else if t, ok := rv.Interface().(Tuple); ok {
return e.encodeTuple(t)
} else {
return e.encodeArray(rv)
}
......
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