mirror of
https://github.com/redis/go-redis.git
synced 2025-07-13 15:01:46 +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:
@ -5492,8 +5492,6 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
|
|||||||
|
|
||||||
section := ""
|
section := ""
|
||||||
scanner := bufio.NewScanner(strings.NewReader(val))
|
scanner := bufio.NewScanner(strings.NewReader(val))
|
||||||
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
|
|
||||||
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
if strings.HasPrefix(line, "#") {
|
if strings.HasPrefix(line, "#") {
|
||||||
@ -5504,6 +5502,7 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
|
|||||||
cmd.val[section] = make(map[string]string)
|
cmd.val[section] = make(map[string]string)
|
||||||
} else if line != "" {
|
} else if line != "" {
|
||||||
if section == "Modules" {
|
if section == "Modules" {
|
||||||
|
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
|
||||||
kv := moduleRe.FindStringSubmatch(line)
|
kv := moduleRe.FindStringSubmatch(line)
|
||||||
if len(kv) == 3 {
|
if len(kv) == 3 {
|
||||||
cmd.val[section][kv[1]] = kv[2]
|
cmd.val[section][kv[1]] = kv[2]
|
||||||
|
Reference in New Issue
Block a user