1 Commits
Author SHA1 Message Date
clawbot 2a9e4fbcdc CODE_STYLEGUIDE_GO: propose naming rules (closes #174)
check / check (push) Successful in 24s
Adds a Naming section to the Go style guide: ten rules for package
names, fourteen for exported names as the caller reads them, and three
for local names. Each is one rule with its reason.

The sentence that banned `util` now points to the section, which bans
it along with `model`, `common`, `types`, `helpers`, `api` and the
like, and says what to name the package instead.

The guide's error example now uses an `Err` name, as the new rule on
error values asks.

This is a proposal. Nothing is renamed in any repo until sneak
approves or amends the rules.

Model: fable-5-2 (proposal); opus-5-5 (rework)
2026-11-16 06:47:35 +00:00
+3 -3
View File
@@ -564,9 +564,9 @@ exported name, and reads them as one name: `http.Server`, `list.New`.
`SetOwner()`), because the capital letter already tells the method from the
field.
1. Start a getter's name with `Fetch` when it reads the value from a database
or the network (`FetchOwner`, never `Owner` or `GetOwner`), because the
reader must know the call can be slow or fail.
1. Begin a function's name with `Fetch` or `Load` when it returns a value from
a database or the network (`FetchOwner`, never `GetOwner` or `Owner`),
because the reader must know the call can be slow or fail.
1. Name a one-method interface for its method plus `er` (`Reader`,
`Formatter`), because the name then says the one thing a value of it does.