golangci-lint: add forbidigo rules to prevent regex.MustCompile

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-04-12 14:55:53 +02:00
parent 1477874494
commit 5dcdd5484b

View File

@@ -61,6 +61,10 @@ issues:
- linters:
- revive
text: "redefines-builtin-id"
- linters:
- forbidigo
text: 'use of `regexp.MustCompile` forbidden'
path: _test\.go
linters-settings:
depguard:
@@ -69,6 +73,11 @@ linters-settings:
deny:
- pkg: github.com/opencontainers/runc
desc: We don't want to depend on runc (libcontainer), unless there is no other option; see https://github.com/opencontainers/runc/issues/3028.
forbidigo:
forbid:
- pkg: ^regexp$
p: ^regexp\.MustCompile
msg: Use internal/lazyregexp.New instead.
gosec:
# The following issues surfaced when `gosec` linter