Skip to content

Commit 7fde1f7

Browse files
committed
cli/context/store: use lazyregexp to compile regexes on first use
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent d5a8cd4 commit 7fde1f7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cli/context/store/store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ import (
1414
"net/http"
1515
"path"
1616
"path/filepath"
17-
"regexp"
1817
"strings"
1918

19+
"github.com/docker/cli/internal/lazyregexp"
2020
"github.com/docker/docker/errdefs"
2121
"github.com/opencontainers/go-digest"
2222
"github.com/pkg/errors"
2323
)
2424

2525
const restrictedNamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_.+-]+$"
2626

27-
var restrictedNameRegEx = regexp.MustCompile(restrictedNamePattern)
27+
var restrictedNameRegEx = lazyregexp.New(restrictedNamePattern)
2828

2929
// Store provides a context store for easily remembering endpoints configuration
3030
type Store interface {

0 commit comments

Comments
 (0)