What problem does it solve?
This guide removes ambiguity and inconsistency in Go code by prescribing straightforward conventions for error formatting, boolean naming, and enum-like fields so code reviews and maintenance become faster and less error-prone.
Core Features & Use Cases
- Error wrapping and context: Encourage using fmt.Errorf with %w and including a brief description of the failing operation so logs show which call produced the error.
- Boolean naming: Require boolean variables and struct fields to be prefixed with Is for exported or is for unexported identifiers to make intent explicit.
- Enum-like string types: Define named string types with constant values, store them as TEXT in the database, and prefer human-readable UPPERCASE values to avoid brittle schema migrations.
- Use Case: Apply these rules when authoring or reviewing service code, libraries, and database models to improve readability and simplify debugging.
Quick Start
Ask the assistant to review a Go source file and suggest changes to use fmt.Errorf with %w for error returns, rename boolean fields to Is/is prefixes, and convert fixed-value fields into named string types with uppercase constant values.