Skip to content

Commit 449fc6d

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
cleanup: refine subscriptionIDRegex
1 parent 2026784 commit 449fc6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/azurefile/utils.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242
tagKeyValueDelimiter = "="
4343
)
4444

45+
var subscriptionIDRegex = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`)
46+
4547
// lockMap used to lock on entries
4648
type lockMap struct {
4749
sync.Mutex
@@ -361,7 +363,7 @@ func getFileServiceURL(accountName, storageEndpointSuffix string) string {
361363
}
362364

363365
func isValidSubscriptionID(subsID string) bool {
364-
return regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`).MatchString(subsID)
366+
return subscriptionIDRegex.MatchString(subsID)
365367
}
366368

367369
// RemoveOptionIfExists removes the given option from the list of options

0 commit comments

Comments
 (0)