styleguide icon indicating copy to clipboard operation
styleguide copied to clipboard

Clarification needed for single-word naming conventions in Go Style Guide

Open james5635 opened this issue 4 months ago • 0 comments

https://github.com/google/styleguide/blob/1387bff19c141c047c483cbe813659625f93defa/go/guide.md?plain=1#L402-L412

The style guide explains that multi-word names in Go should use MixedCaps (camelCase) rather than underscores. For example:

  • MaxLength (exported)
  • maxLength (unexported)

However, the guide doesn’t clearly state what the convention is for single-word names.

Questions:

  • Should single-word identifiers always be lowercase for unexported names (e.g., count, user)?
  • Should exported single-word identifiers use leading uppercase (e.g., Error, String), similar to how the standard library does it?

This clarification would help newcomers understand whether there are any exceptions or additional rules for single-word names beyond the standard capitalization rules.

Thanks!

james5635 avatar Sep 05 '25 13:09 james5635