Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Add check for MixedCaps in package name #285

Closed
wants to merge 1 commit into from

Conversation

jstemmer
Copy link
Contributor

@jstemmer jstemmer commented Apr 6, 2017

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."

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Caps/MixedCaps ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@gopherbot
Copy link

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

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."
@gopherbot
Copy link

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link

Message from Andrew Bonventre:

Patch Set 2: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/96080.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

This PR is being closed because golang.org/cl/96080 has been merged.

@gopherbot gopherbot closed this Feb 24, 2018
gopherbot pushed a commit that referenced this pull request Feb 24, 2018
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]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants