From 75f791d904218089c8a75c5ba0ec5dd0c4da4742 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 15 Jul 2024 16:22:53 +0200 Subject: [PATCH] builder: use lazyregexp to compile regexes on first use Signed-off-by: Sebastiaan van Stijn --- cli/command/image/build/internal/urlutil/urlutil.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/command/image/build/internal/urlutil/urlutil.go b/cli/command/image/build/internal/urlutil/urlutil.go index e8459cc820..34c603cbc3 100644 --- a/cli/command/image/build/internal/urlutil/urlutil.go +++ b/cli/command/image/build/internal/urlutil/urlutil.go @@ -6,13 +6,14 @@ package urlutil // import "github.com/docker/docker/builder/remotecontext/urlutil" import ( - "regexp" "strings" + + "github.com/docker/docker/internal/lazyregexp" ) // urlPathWithFragmentSuffix matches fragments to use as Git reference and build // context from the Git repository. See IsGitURL for details. -var urlPathWithFragmentSuffix = regexp.MustCompile(`\.git(?:#.+)?$`) +var urlPathWithFragmentSuffix = lazyregexp.New(`\.git(?:#.+)?$`) // IsURL returns true if the provided str is an HTTP(S) URL by checking if it // has a http:// or https:// scheme. No validation is performed to verify if the