Use correct regexp package
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
This commit is contained in:
parent
3212e446e5
commit
dbac7cf1fb
@ -21,8 +21,9 @@ import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
|
||||
"regexp"
|
||||
|
||||
cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2"
|
||||
"gopkg.in/src-d/enry.v1/regex"
|
||||
)
|
||||
|
||||
func ComputeCertificateRequestName(crt *cmapi.Certificate) (string, error) {
|
||||
@ -42,7 +43,7 @@ func ComputeCertificateRequestName(crt *cmapi.Certificate) (string, error) {
|
||||
// shorten the cert name to 52 chars to ensure the total length of the name
|
||||
// also shorten the 52 char string to the last non-symbol character
|
||||
// is less than or equal to 64 characters
|
||||
validCharIndexes := regex.MustCompile(`[a-zA-Z\d]`).FindAllStringIndex(fmt.Sprintf("%.52s", crt.Name), -1)
|
||||
validCharIndexes := regexp.MustCompile(`[a-zA-Z\d]`).FindAllStringIndex(fmt.Sprintf("%.52s", crt.Name), -1)
|
||||
crt.Name = crt.Name[:validCharIndexes[len(validCharIndexes)-1][1]]
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user