docker/reference.literal: return QuoteMeta directly

Drop allocs from 4501 to 4413.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2022-11-30 10:45:59 +01:00
parent 54d770f850
commit e2cf031b80
1 changed files with 1 additions and 7 deletions

View File

@ -120,13 +120,7 @@ var re = regexp.MustCompile
// literal compiles s into a literal regular expression, escaping any regexp
// reserved characters.
func literal(s string) string {
re := re(regexp.QuoteMeta(s))
if _, complete := re.LiteralPrefix(); !complete {
panic("must be a literal")
}
return re.String()
return regexp.QuoteMeta(s)
}
// expression defines a full expression, where each regular expression must