diff --git a/lint/utils.go b/lint/utils.go index 1efa41f..6ccfb0e 100644 --- a/lint/utils.go +++ b/lint/utils.go @@ -71,6 +71,10 @@ func Name(name string, allowlist, blocklist []string) (should string) { if w == 0 && unicode.IsLower(runes[w]) { u = strings.ToLower(u) } + // Keep lowercase s for IDs + if u == "IDS" { + u = "IDs" + } // All the common initialisms are ASCII, // so we can replace the bytes exactly. copy(runes[w:], []rune(u)) @@ -99,6 +103,7 @@ var commonInitialisms = map[string]bool{ "HTTP": true, "HTTPS": true, "ID": true, + "IDS": true, "IP": true, "JSON": true, "LHS": true, diff --git a/testdata/var-naming.go b/testdata/var-naming.go index 2cf86f3..4a96dd8 100644 --- a/testdata/var-naming.go +++ b/testdata/var-naming.go @@ -2,6 +2,7 @@ package fixtures func foo() string { customId := "result" - customVm := "result" // MATCH /var customVm should be customVM/ + customVm := "result" // MATCH /var customVm should be customVM/ + customIds := "result" // MATCH /var customIds should be customIDs/ return customId }