diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-22 09:00:08 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-22 09:00:08 +0300 |
| commit | 5e5faf1aca304598302c5f50a2dd88ce84e332bf (patch) | |
| tree | 0471d3964521dd0889b4666ac0ea441dd888bfa9 /prompts | |
| parent | 76307f4826efbf995b0be72392282fccd62daf00 (diff) | |
Update
Diffstat (limited to 'prompts')
| -rw-r--r-- | prompts/skills/go-best-practices/SKILL.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/prompts/skills/go-best-practices/SKILL.md b/prompts/skills/go-best-practices/SKILL.md index e0e384b..c03e91d 100644 --- a/prompts/skills/go-best-practices/SKILL.md +++ b/prompts/skills/go-best-practices/SKILL.md @@ -43,6 +43,7 @@ When writing or modifying Go code in the current project, follow all of the conv ### Errors and interfaces * Use error wrapping (`fmt.Errorf` with `%w`) to provide context for errors +* Never silently ignore returned errors—check them, or discard them explicitly with `_ =`. Run `errcheck ./...` to catch silently ignored errors (install and usage: `references/errcheck.md`) * Prefer explicit interface satisfaction for public types: `var _ MyInterface = (*MyType)(nil)` * Keep interfaces small and focused; accept interfaces, return concrete types @@ -65,6 +66,13 @@ When writing or modifying Go code in the current project, follow all of the conv * Avoid large functions; split into smaller, focused helpers (max ~50 lines per function) * Avoid code duplication where reasonable +### AI-assisted tools and guardrails + +When writing or modifying Go code (especially with an AI agent), run static-analysis guardrails as part of verification, not just `go build`/`go test`. + +* **errcheck:** Run `errcheck ./...` to catch silently ignored errors—one of the most common Go bugs. Treat findings as defects: check the error (wrap with `%w`) or discard it explicitly with `_ =`. Do not silence it by deleting the check. See `references/errcheck.md` for install instructions, flags, exclude files, and how to wire it into the Magefile / CI / pre-commit hooks. +* Be honest about what actually ran: if errcheck (or any tool) is not installed or could not run, say so rather than implying the code was checked. + ### Environment preflight and verification honesty Before claiming any verification, confirm the local toolchain can actually build and run the relevant tests. A *missing or incomplete* toolchain (not slow tests) is common: e.g. CGO headers absent (`bpf/bpf.h` for eBPF code), or external tools not installed (`flutter`/`dart` for a companion app). |
