Skip to content

Commit 4c820d3

Browse files
committedApr 10, 2025··
golangci-lint: add forbidigo rules to prevent regex.MustCompile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent ced66f2 commit 4c820d3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎.golangci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ linters:
77
- dupword # Detects duplicate words.
88
- durationcheck
99
- errchkjson
10+
- forbidigo
1011
- gocritic # Metalinter; detects bugs, performance, and styling issues.
1112
- gocyclo
1213
- gofumpt # Detects whether code was gofumpt-ed.
@@ -66,6 +67,11 @@ linters-settings:
6667
desc: Use github.com/google/uuid instead.
6768
- pkg: "io/ioutil"
6869
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
70+
forbidigo:
71+
forbid:
72+
- pkg: ^regexp$
73+
p: ^regexp\.MustCompile
74+
msg: Use internal/lazyregexp.New instead.
6975
gocyclo:
7076
min-complexity: 16
7177
gosec:

0 commit comments

Comments
 (0)
Please sign in to comment.