Skip to content

Commit f3c2711

Browse files
alingsendyakov
andauthored
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>
1 parent 7e517ec commit f3c2711

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

command.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,8 +5492,6 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
54925492

54935493
section := ""
54945494
scanner := bufio.NewScanner(strings.NewReader(val))
5495-
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
5496-
54975495
for scanner.Scan() {
54985496
line := scanner.Text()
54995497
if strings.HasPrefix(line, "#") {
@@ -5504,6 +5502,7 @@ func (cmd *InfoCmd) readReply(rd *proto.Reader) error {
55045502
cmd.val[section] = make(map[string]string)
55055503
} else if line != "" {
55065504
if section == "Modules" {
5505+
moduleRe := regexp.MustCompile(`module:name=(.+?),(.+)$`)
55075506
kv := moduleRe.FindStringSubmatch(line)
55085507
if len(kv) == 3 {
55095508
cmd.val[section][kv[1]] = kv[2]

0 commit comments

Comments
 (0)