Skip to content

Commit 02d72f1

Browse files
committed
Use regexache
1 parent cd57605 commit 02d72f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/service/lambda/invocation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"errors"
1111
"fmt"
1212
"log"
13-
"regexp"
1413
"strings"
1514

15+
"github.com/YakDriver/regexache"
1616
"github.com/aws/aws-sdk-go-v2/aws"
1717
"github.com/aws/aws-sdk-go-v2/service/lambda"
1818
awstypes "github.com/aws/aws-sdk-go-v2/service/lambda/types"
@@ -48,7 +48,7 @@ func resourceInvocation() *schema.Resource {
4848
},
4949
},
5050
Importer: &schema.ResourceImporter{
51-
StateContext: func(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
51+
StateContext: func(ctx context.Context, d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) {
5252
functionName, qualifier, _, err := invocationParseResourceID(d.Id())
5353
if err != nil {
5454
return nil, err
@@ -285,12 +285,12 @@ func invocationParseResourceID(id string) (string, string, string, error) {
285285
resultHash := parts[2]
286286

287287
// Validate qualifier format
288-
if qualifier != "$LATEST" && !regexp.MustCompile(`^[0-9]+$`).MatchString(qualifier) {
288+
if qualifier != "$LATEST" && !regexache.MustCompile(`^[0-9]+$`).MatchString(qualifier) {
289289
return "", "", "", fmt.Errorf("invalid qualifier format: %s, expected $LATEST or numeric version", qualifier)
290290
}
291291

292292
// Validate hash format (should be MD5 - 32 hex chars)
293-
if !regexp.MustCompile(`^[a-f0-9]{32}$`).MatchString(resultHash) {
293+
if !regexache.MustCompile(`^[a-f0-9]{32}$`).MatchString(resultHash) {
294294
return "", "", "", fmt.Errorf("invalid result hash format: %s, expected 32-character MD5 hash", resultHash)
295295
}
296296

0 commit comments

Comments
 (0)