Instruction file imported from ruaan-deysel/vault (
.github/instructions/go.instructions.md). Copyright stays with the author.
Go Instructions
- Use
gofmtandgoimports. - Follow existing package naming and error-handling style.
- Wrap errors with operation context using
%w; useerrors.Isorerrors.Aswhen callers need classification. - Log once at the handling boundary, not at every return.
- Propagate
context.Context; do not store request contexts in long-lived structs. - Keep
CGO_ENABLED=0compatibility. - Use build tags and stubs for platform-specific implementations.
- Find every caller before changing a shared function, interface, or behavior.
- Prefer the standard library and existing project helpers over new dependencies or abstractions.
- Run targeted tests, then
make testandmake lintwhen the change warrants the full Go gate.