google / google/styleguide

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

Open
#940 0 comments 0 reactions 0 assignees View on GitHub
lang:go
Dominant language
HTML
Stars
39.6k
Forks
12.9k
Avg merge
42m
Merged PRs (30d)
15

Description

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.