Go Rules
Go toolchain commands for building, testing, and managing modules. Format code, run benchmarks, and handle dependencies.
4 rules
Error Handling Conventions
Handle every error explicitly in Go — never ignore returned errors, wrap errors with context using fmt.Errorf, and use errors.Is/As for type checking instead of string comparison.
Mandatory gofmt Formatting
All Go code must be formatted with gofmt — no exceptions, no alternatives, no debates. Configure editors and CI to format automatically on save and reject unformatted code.
Interface Design Principles
Design Go interfaces the idiomatic way — accept interfaces, return structs, keep interfaces small, define them at the consumer side, and never export interfaces with only one implementation.
Go Naming Conventions
Follow Go's naming conventions strictly — MixedCaps for exports, mixedCaps for unexported, short receiver names, acronym casing, and meaningful package names without stuttering.