Skip to content

Commit 694176c

Browse files
cxljsofekshenawa
authored andcommitted
fix: insert entry during iterating over a map (redis#3398)
Signed-off-by: fukua95 <[email protected]>
1 parent 1a80be7 commit 694176c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

command.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4355,15 +4355,14 @@ func (c *cmdsInfoCache) Get(ctx context.Context) (map[string]*CommandInfo, error
43554355
return err
43564356
}
43574357

4358+
lowerCmds := make(map[string]*CommandInfo, len(cmds))
4359+
43584360
// Extensions have cmd names in upper case. Convert them to lower case.
43594361
for k, v := range cmds {
4360-
lower := internal.ToLower(k)
4361-
if lower != k {
4362-
cmds[lower] = v
4363-
}
4362+
lowerCmds[internal.ToLower(k)] = v
43644363
}
43654364

4366-
c.cmds = cmds
4365+
c.cmds = lowerCmds
43674366
return nil
43684367
})
43694368
return c.cmds, err

0 commit comments

Comments
 (0)