docker/reference.expression: use strings.Join()

To drop the unbelievable amount of 2 allocs on init().

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

View File

@ -1,6 +1,9 @@
package reference
import "regexp"
import (
"regexp"
"strings"
)
const (
// alphaNumeric defines the alpha numeric atom, typically a
@ -126,12 +129,7 @@ func literal(s string) string {
// expression defines a full expression, where each regular expression must
// follow the previous.
func expression(res ...string) string {
var s string
for _, re := range res {
s += re
}
return s
return strings.Join(res, "")
}
// optional wraps the expression in a non-capturing group and makes the