Skip to content

Commit 19a95d9

Browse files
authored
resolve #867: remove k[A-Z][A-Za-z\d]*$ sub-rule from var-naming (#871)
1 parent 16871ed commit 19a95d9

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

rule/var-naming.go

-9
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,6 @@ func (w *lintNames) check(id *ast.Ident, thing string) {
141141
})
142142
return
143143
}
144-
if len(id.Name) > 2 && id.Name[0] == 'k' && id.Name[1] >= 'A' && id.Name[1] <= 'Z' {
145-
should := string(id.Name[1]+'a'-'A') + id.Name[2:]
146-
w.onFailure(lint.Failure{
147-
Failure: fmt.Sprintf("don't use leading k in Go names; %s %s should be %s", thing, id.Name, should),
148-
Confidence: 0.8,
149-
Node: id,
150-
Category: "naming",
151-
})
152-
}
153144

154145
should := lint.Name(id.Name, w.whitelist, w.blacklist)
155146
if id.Name == should {

testdata/golint/var-naming.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ func f_it() { // MATCH /don't use underscores in Go names; func f_it should be f
5757

5858
// Common styles in other languages that don't belong in Go.
5959
const (
60-
CPP_CONST = 1 // MATCH /don't use ALL_CAPS in Go names; use CamelCase/
61-
kLeadingKay = 2 // MATCH /don't use leading k in Go names; const kLeadingKay should be leadingKay/
60+
CPP_CONST = 1 // MATCH /don't use ALL_CAPS in Go names; use CamelCase/
6261

6362
HTML = 3 // okay; no underscore
6463
X509B = 4 // ditto

0 commit comments

Comments
 (0)