golangci-lint: fix invalid nakedret config, disallow for any func length

The regex was added before we migrateed from gometalinter in
dbd96badb6959c2b7070664aecbcf0f7c299c538, and got migrated to golangci-lint
in b7e06f2845bb4996269a49f2592a735e4cd03e49. The format used for the config
was invalid, and migrating it to the right format didn't make a difference,
so we can remove it.

As naked returns are generally not desirable, also setting the minimum func
length to 0 (i.e., don't allow any naked returns), instead of the default

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-02-18 09:35:30 +01:00
parent a5020ea165
commit 1c8243cc95
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -17,7 +17,7 @@ linters:
- ineffassign
- lll
- misspell # Detects commonly misspelled English words in comments.
- nakedret
- nakedret # Detects uses of naked returns.
- nilerr # Detects code that returns nil even if it checks that the error is not nil.
- nolintlint # Detects ill-formed or insufficient nolint directives.
- perfsprint # Detects fmt.Sprintf uses that can be replaced with a faster alternative.
@ -81,8 +81,9 @@ linters-settings:
lll:
line-length: 200
nakedret:
command: nakedret
pattern: ^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$
# Disallow naked returns if func has more lines of code than this setting.
# Default: 30
max-func-lines: 0
revive:
rules: