Go Code Review Comments
Primary reference: Code Review Comments on the Go wiki.
When writing or reviewing Go code in this project, align with that document. Below are points that come up often for public API naming and day-to-day edits.
Initialisms
Words that are acronyms or initialisms (URL, HTTP, ID, CIDR, JSON, etc.) use consistent casing in identifiers:
- Good:
ServeHTTP, parseURL, userID, IsCIDR, ErrInvalidCIDR, CIDROptions
- Bad:
ServeHttp, parseUrl, userId, IsCidr, CidrOptions
For multi-part names, either keep each initialism consistent (e.g. xmlHTTPRequest) or use the wiki’s patterns; never mix Url / URL or Cidr / CIDR in exported symbols.
When adding constraints or helpers named after a standard (CIDR, UUID, ISIN, …), check the acronym’s usual spelling in Go’s standard library and popular code (e.g. net.ParseCIDR — the concept is CIDR; exported wrappers here use CIDR in type and function names).
Other high-signal items from the wiki
Skim the full wiki for the full list. In practice, also watch for:
- Package comments —
// Package foo ... on the package clause file.
- Doc comments — complete sentences, start with the name being documented.
- Error strings — lowercase, no trailing punctuation (for wrapped errors /
errors.New text where applicable).
- Line length — no hard limit in the wiki, but keep readable; wrap long signatures or struct literals.
- Indent error paths — handle errors first, reduce nesting (
if err != nil { return err }).
Relation to this repo
golangci-lint (see AGENTS.md) enforces some overlapping rules (e.g. predeclared, cyclop). The wiki is the guide for naming and idioms that linters may not fully cover.
- When adding features documented in
validation-add-constraint, apply Initialisms for any new exported names in it, validate, is, message, and root validation errors.
Checklist (quick)
Source: muonsoft/validation — distributed by TomeVault.
1---2name: golang-code-review-comments3description: Applies Go community style from the official Code Review Comments wiki. Use when naming APIs, structuring code, or reviewing Go changes in this repository. Use when this capability is needed.4---56# Go Code Review Comments78Primary reference: **[Code Review Comments](https://go.dev/wiki/CodeReviewComments)** on the Go wiki.910When writing or reviewing Go code in this project, align with that document. Below are points that come up often for **public API naming** and day-to-day edits.1112---1314## Initialisms1516Words that are acronyms or initialisms (URL, HTTP, ID, CIDR, JSON, etc.) use **consistent casing** in identifiers:1718- Good: `ServeHTTP`, `parseURL`, `userID`, `IsCIDR`, `ErrInvalidCIDR`, `CIDROptions`19- Bad: `ServeHttp`, `parseUrl`, `userId`, `IsCidr`, `CidrOptions`2021For multi-part names, either keep each initialism consistent (e.g. `xmlHTTPRequest`) or use the wiki’s patterns; **never** mix `Url` / `URL` or `Cidr` / `CIDR` in exported symbols.2223When adding constraints or helpers named after a standard (CIDR, UUID, ISIN, …), check the acronym’s usual spelling in Go’s standard library and popular code (e.g. `net.ParseCIDR` — the concept is CIDR; exported wrappers here use `CIDR` in type and function names).2425---2627## Other high-signal items from the wiki2829Skim the full wiki for the full list. In practice, also watch for:3031- **Package comments** — `// Package foo ...` on the package clause file.32- **Doc comments** — complete sentences, start with the name being documented.33- **Error strings** — lowercase, no trailing punctuation (for wrapped errors / `errors.New` text where applicable).34- **Line length** — no hard limit in the wiki, but keep readable; wrap long signatures or struct literals.35- **Indent error paths** — handle errors first, reduce nesting (`if err != nil { return err }`).3637---3839## Relation to this repo4041- **`golangci-lint`** (see `AGENTS.md`) enforces some overlapping rules (e.g. `predeclared`, `cyclop`). The wiki is the guide for **naming and idioms** that linters may not fully cover.42- When adding features documented in **`validation-add-constraint`**, apply **Initialisms** for any new exported names in `it`, `validate`, `is`, `message`, and root `validation` errors.4344---4546## Checklist (quick)4748- [ ] Exported names use correct initialism casing (CIDR, URL, ID, …).49- [ ] Godoc on new exported symbols follows comment conventions.50- [ ] Error handling follows early-return style where it improves clarity.51- [ ] For code with **non-trivial structure** (parsers, state machines, several error outcomes), **unit tests** cover boundaries and branches — not only integration-style tests.52- [ ] Full wiki reviewed for non-trivial or controversial changes.5354---55> Source: [muonsoft/validation](https://github.com/muonsoft/validation) — distributed by [TomeVault](https://tomevault.io).56<!-- tomevault:4.0:skill_md:2026-06-16 -->