For brands or words with more than 1 capital letter, lowercase all letters #8

Opendmitshur opened this issue 8 years ago
dmitshur commented 8 years ago · edited

Do this:

// Exported.
var OAuthEnabled bool
var GitHubToken string

// Unexported.
var oauthEnabled bool
var githubToken string

Don't do this:

// Unexported.
var oAuthEnabled bool
var gitHubToken string

Lowercase all letters, not only the first letter, of the first word when you want to make an unexported version.

For consistency with what the Go project does, and because it looks nicer. oAuth is not pretty.

Write Preview Markdown
kylev commented 8 years ago

Perhaps the rule could be clarified by saying both "brands" and "nested acronyms or abbreviations". Since "OAuth" is an abbreviation, smash all uppercase. It also works for SMTPEnvelope -> smtpEnvelope (abbreviation). And SonicWallClient -> sonicwallClient (brand).

Write Preview Markdown
dmitshur commented 8 years ago · edited

@kylev Hmm, I don't think I need to cover acronyms/abbreviations, since that's already covered by https://github.com/golang/go/wiki/CodeReviewComments#initialisms. This suggestion is really meant about brand names, like gRPC, OAuth, GitHub, SonicWall.

SMPTEnvelope just follows the https://github.com/golang/go/wiki/CodeReviewComments#initialisms rule.

Does that make sense?

(Also, brand names that don't begin with a capital letter, but have capital letters elsewhere, are pretty hard to deal with... I'm still not sure what's the best way.)

Write Preview Markdown
to comment.