diff --git a/cli-plugins/manager/plugin.go b/cli-plugins/manager/plugin.go index ec196df16f..fa846452b5 100644 --- a/cli-plugins/manager/plugin.go +++ b/cli-plugins/manager/plugin.go @@ -8,14 +8,14 @@ import ( "os" "os/exec" "path/filepath" - "regexp" "strings" "github.com/docker/cli/cli-plugins/metadata" + "github.com/docker/cli/internal/lazyregexp" "github.com/spf13/cobra" ) -var pluginNameRe = regexp.MustCompile("^[a-z][a-z0-9]*$") +var pluginNameRe = lazyregexp.New("^[a-z][a-z0-9]*$") // Plugin represents a potential plugin with all it's metadata. type Plugin struct { diff --git a/internal/lazyregexp/lazyregexp.go b/internal/lazyregexp/lazyregexp.go index c616a0a05b..62e29c55d0 100644 --- a/internal/lazyregexp/lazyregexp.go +++ b/internal/lazyregexp/lazyregexp.go @@ -75,6 +75,10 @@ func (r *Regexp) ReplaceAllLiteralString(src, repl string) string { return r.re().ReplaceAllLiteralString(src, repl) } +func (r *Regexp) String() string { + return r.re().String() +} + func (r *Regexp) SubexpNames() []string { return r.re().SubexpNames() }