Identifier naming and initialisms
Good Go names optimize readability at call sites; initialisms, receiver names, and getter style should stay consistent and unsurprising.
Canonical guidance
- prefer clear names that read well at use sites
- keep common initialisms consistent in MixedCaps identifiers
- do not prefix ordinary getters with
Get - use short receiver names derived from the type
Use when
- naming exported identifiers
- reviewing method names and receivers
- cleaning up acronym-heavy APIs
Avoid
- inconsistent acronym casing like
HttpServernext toURL GetNamestyle getters without a special reason- long or generic receiver names
Preferred pattern
type HTTPClient struct{}
func (c *HTTPClient) URL() string { return "" }
Anti-pattern
- renaming identifiers for local taste when the result is less familiar to ordinary Go readers
Explanation: This is tempting because naming feels personal, but the reader’s recognition speed matters more than the author’s preference.
Why
- naming is one of the highest-frequency review surfaces in Go, and Google guidance adds useful precision around initialisms and getters
Related pages
Sources
- Go Code Review Comments - Go Team
- Google Go Style Guide - Google
- Google Go Style Decisions - Google