mirror of
https://github.com/redis/go-redis.git
synced 2025-04-16 09:23:06 +03:00
move regexp.MustCompile close to call (#3280)
* move regexp.MustCompile out of func * move moduleRe close to call --------- Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
This commit is contained in:
parent
7e517ec4a1
commit
f3c2711fe1
@ -5492,8 +5492,6 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
|
||||
|
||||
section := ""
|
||||
scanner := bufio.NewScanner(strings.NewReader(val))
|
||||
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
|
||||
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
if strings.HasPrefix(line, "#") {
|
||||
@ -5504,6 +5502,7 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
|
||||
cmd.val[section] = make(map[string]string)
|
||||
} else if line != "" {
|
||||
if section == "Modules" {
|
||||
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
|
||||
kv := moduleRe.FindStringSubmatch(line)
|
||||
if len(kv) == 3 {
|
||||
cmd.val[section][kv[1]] = kv[2]
|
||||
|
Loading…
x
Reference in New Issue
Block a user