Skip to content

Commit 01d8642

Browse files
committed
cli/command/system: use lazyregexp to compile regexes on first use
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent a16c3a4 commit 01d8642

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cli/command/system/info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"errors"
99
"fmt"
1010
"io"
11-
"regexp"
1211
"sort"
1312
"strings"
1413

@@ -19,6 +18,7 @@ import (
1918
"github.com/docker/cli/cli/command/formatter"
2019
"github.com/docker/cli/cli/debug"
2120
flagsHelper "github.com/docker/cli/cli/flags"
21+
"github.com/docker/cli/internal/lazyregexp"
2222
"github.com/docker/cli/templates"
2323
"github.com/docker/docker/api/types/swarm"
2424
"github.com/docker/docker/api/types/system"
@@ -142,7 +142,7 @@ func addServerInfo(ctx context.Context, dockerCli command.Cli, format string, in
142142

143143
// placeHolders does a rudimentary match for possible placeholders in a
144144
// template, matching a '.', followed by an letter (a-z/A-Z).
145-
var placeHolders = regexp.MustCompile(`\.[a-zA-Z]`)
145+
var placeHolders = lazyregexp.New(`\.[a-zA-Z]`)
146146

147147
// needsServerInfo detects if the given template uses any server information.
148148
// If only client-side information is used in the template, we can skip

0 commit comments

Comments
 (0)