From 4c820d3ac0e1f277f902cece2c3dc18e570e6fb9 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 10 Apr 2025 12:21:59 +0200 Subject: [PATCH] golangci-lint: add forbidigo rules to prevent regex.MustCompile Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 750eff5d51..73ef1f80da 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,6 +7,7 @@ linters: - dupword # Detects duplicate words. - durationcheck - errchkjson + - forbidigo - gocritic # Metalinter; detects bugs, performance, and styling issues. - gocyclo - gofumpt # Detects whether code was gofumpt-ed. @@ -66,6 +67,11 @@ linters-settings: desc: Use github.com/google/uuid instead. - pkg: "io/ioutil" desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil + forbidigo: + forbid: + - pkg: ^regexp$ + p: ^regexp\.MustCompile + msg: Use internal/lazyregexp.New instead. gocyclo: min-complexity: 16 gosec: