1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Convert bytes to string in Cmd.

This commit is contained in:
Vladimir Mihailenco
2016-04-12 19:41:56 +03:00
parent 889409de38
commit 818785577e
3 changed files with 16 additions and 7 deletions

View File

@ -165,7 +165,12 @@ func (cmd *Cmd) readReply(cn *pool.Conn) error {
cmd.err = err
return cmd.err
}
cmd.val = val
if b, ok := val.([]byte); ok {
// Bytes must be copied, because underlying memory is reused.
cmd.val = string(b)
} else {
cmd.val = val
}
return nil
}