From 7fde1f799fb3aaa3a3ec8872b50d0dde43a573e1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 10 Apr 2025 11:45:44 +0200 Subject: [PATCH] cli/context/store: use lazyregexp to compile regexes on first use Signed-off-by: Sebastiaan van Stijn --- cli/context/store/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/context/store/store.go b/cli/context/store/store.go index ee50cca1c7..1895a1efb4 100644 --- a/cli/context/store/store.go +++ b/cli/context/store/store.go @@ -14,9 +14,9 @@ import ( "net/http" "path" "path/filepath" - "regexp" "strings" + "github.com/docker/cli/internal/lazyregexp" "github.com/docker/docker/errdefs" "github.com/opencontainers/go-digest" "github.com/pkg/errors" @@ -24,7 +24,7 @@ import ( const restrictedNamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_.+-]+$" -var restrictedNameRegEx = regexp.MustCompile(restrictedNamePattern) +var restrictedNameRegEx = lazyregexp.New(restrictedNamePattern) // Store provides a context store for easily remembering endpoints configuration type Store interface {