-
Notifications
You must be signed in to change notification settings - Fork 492
Add check for MixedCaps in package name #285
Conversation
lint.go
Outdated
@@ -521,6 +524,9 @@ func (f *file) lintNames() { | |||
if strings.Contains(f.f.Name.Name, "_") && !strings.HasSuffix(f.f.Name.Name, "_test") { | |||
f.errorf(f.f, 1, link("http://golang.org/doc/effective_go.html#package-names"), category("naming"), "don't use an underscore in package name") | |||
} | |||
if anyCapsRE.MatchString(f.f.Name.Name) { | |||
f.errorf(f.f, 1, link("http://golang.org/doc/effective_go.html#package-names"), category("mixed-caps"), "don't use Caps in package name; %s should be %s", f.f.Name.Name, strings.ToLower(f.f.Name.Name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Caps/MixedCaps ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR (HEAD: 5f79ffa) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/lint/+/96080 to see it. Tip: You can toggle comments from me using the |
Lint already checks for underscores in package names, but did not yet check for lower case names. The section on Package names in the Effective Go document states that "By convention, packages packages are given lower case, single-word names; there should be no need for underscores or mixedCaps."
5f79ffa
to
91b0fc6
Compare
This PR (HEAD: 91b0fc6) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/lint/+/96080 to see it. Tip: You can toggle comments from me using the |
Message from Andrew Bonventre: Patch Set 2: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/96080. |
This PR is being closed because golang.org/cl/96080 has been merged. |
Lint already checks for underscores in package names, but did not yet check for lower case names. The section on Package names in the Effective Go document states that "By convention, packages packages are given lower case, single-word names; there should be no need for underscores or mixedCaps." GitHub-Last-Rev: 91b0fc6 GitHub-Pull-Request: #285 Change-Id: Ibb234166360b67f0f561b463a951a87399cad1d3 Reviewed-on: https://go-review.googlesource.com/96080 Reviewed-by: Andrew Bonventre <[email protected]>
Lint already checks for underscores in package names, but did not yet
check for lower case names. The section on Package names in the
Effective Go document states that "By convention, packages packages are
given lower case, single-word names; there should be no need for
underscores or mixedCaps."