We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5723398 commit 82d1303Copy full SHA for 82d1303
redisdump/redisdump.go
@@ -55,13 +55,12 @@ func zsetToRedisCmd(k string, val []string) []string {
55
56
// RESPSerializer will serialize cmd to RESP
57
func RESPSerializer(cmd []string) string {
58
- s := ""
59
- s += "*" + strconv.Itoa(len(cmd)) + "\r\n"
+ buf := strings.Builder{}
+ buf.WriteString("*" + strconv.Itoa(len(cmd)) + "\r\n")
60
for _, arg := range cmd {
61
- s += "$" + strconv.Itoa(len(arg)) + "\r\n"
62
- s += arg + "\r\n"
+ buf.WriteString("$" + strconv.Itoa(len(arg)) + "\r\n" + arg + "\r\n")
63
}
64
- return s
+ return buf.String()
65
66
67
// RedisCmdSerializer will serialize cmd to a string with redis commands
0 commit comments