Closed
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- I updated revive
go install github.com/mgechev/revive@latest
- I run it with the following flags & configuration file:
package main
import (
"context"
"log/slog"
)
func main() {
slog.Default().InfoContext(context.Background(), "key1")
slog.Default().InfoContext(context.Background(), "key1")
slog.Default().InfoContext(context.Background(), "key1")
slog.Default().InfoContext(context.Background(), "key1")
slog.InfoContext(context.Background(), "key2")
slog.InfoContext(context.Background(), "key2")
slog.InfoContext(context.Background(), "key2")
slog.InfoContext(context.Background(), "key2")
}
# flags
golangci-lint run
linters:
enable:
- revive
linters-settings:
revive:
enable-all-rules: true
rules:
- name: add-constant
severity: warning
disabled: false
arguments:
- maxLitCount: "3"
ignoreFuncs: 'slog\.*,fmt\.*,InfoContext\.*'
Expected behavior
A clear and concise description of what you expected to happen.
It didn't report "key1" for add-constant.
Logs
If applicable, add screenshots to help explain your problem.
main.go:12:51: add-constant: string literal "key1" appears, at least, 4 times, create a named constant for it (revive)
slog.Default().InfoContext(context.Background(), "key1")
Desktop (please complete the following information):
- OS: [e.g. Ubuntu 18.04]
- Version of Go
go version go1.22.2 darwin/arm64
golangci-lint has version v1.59.0 built with go1.22.2 from (unknown, modified: ?, mod sum: "h1:st69YDnAH/v2QXDcgUaZ0seQajHScPALBVkyitYLXEk=") on (unknown)
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels