cli/context/store: use lazyregexp to compile regexes on first use

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-04-10 11:45:44 +02:00
parent d5a8cd4093
commit 7fde1f799f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -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 {