daemon/names: use lazyregexp

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-01-01 22:07:53 +01:00
parent b7c88502fb
commit 86e470fe3a

View File

@@ -1,9 +1,9 @@
package names // import "github.com/docker/docker/daemon/names"
import "regexp"
import "github.com/docker/docker/internal/lazyregexp"
// RestrictedNameChars collects the characters allowed to represent a name, normally used to validate container and volume names.
const RestrictedNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.-]`
// RestrictedNamePattern is a regular expression to validate names against the collection of restricted characters.
var RestrictedNamePattern = regexp.MustCompile(`^` + RestrictedNameChars + `+$`)
var RestrictedNamePattern = lazyregexp.New(`^` + RestrictedNameChars + `+$`)