Closed dro-sh closed 1 year ago
Hello,
you can set use-field-name
to false
or just exclude the fields:
type WithArrays struct {
ModelIDs []string `json:"modelsIds"` //nolint:tagliatelle
MembersIDs []string `json:"membersIds"` //nolint:tagliatelle
}
Can it be fixed at future? Or it is a false positive and cannot be detected?
The problem here is that ID is an acronym like HTTP, CIA, etc.
type WithAcronyms struct {
FooIDs string `json:"fooIds"`
BarHTTPs string `json:"barHTTPs"`
BarEXAMPLEs string `json:"barEXAMPLEs"`
}
$ golangci-lint run
foo.go:4:21: json(camel): got 'fooIds' want 'fooIDs' (tagliatelle)
FooIDs string `json:"fooIds"`
^
foo.go:5:21: json(camel): got 'barHTTPs' want 'barHttPs' (tagliatelle)
BarHTTPs string `json:"barHTTPs"`
^
foo.go:6:21: json(camel): got 'barEXAMPLEs' want 'barExamplEs' (tagliatelle)
BarEXAMPLEs string `json:"barEXAMPLEs"`
^
Being smart with acronyms is complex and the root of unwanted side effects.
Okey, thanks :)
I have a struct with array of IDs. Structure:
Config:
But linter thinks that it is a part of field name. I should disable linter for whole structure.
Is there a way to fix it?