Go Review
Testing & Qualitygo-reviewGo Review is an Agent Skill for testing & quality published in the replicate/cog repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Go code review guidelines for the Cog codebase
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/replicate/cog/blob/HEAD/.opencode/skills/go-review/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/go-review, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Go review guidelines
This project uses Go for the CLI (cmd/cog/, pkg/) and support tooling (tools/).
What linters already catch (skip these)
golangci-lint runs errcheck, gocritic, gosec, govet, ineffassign, misspell, revive, staticcheck, and unused. Don't flag issues these would catch.
What to look for
Error handling
- Errors returned but not checked or silently discarded
- User-facing errors should use
pkg/errors.CodedErrorwith error codes - Generic error wrapping that loses context (
fmt.Errorf("failed")with no%w)
Imports
- Should be three groups: stdlib, third-party, internal (
github.com/replicate/cog/pkg/...) - Only flag if actually wrong, not cosmetic reordering
Testing
- Must use
testify/requirefor fatal assertions andtestify/assertfor non-fatal - No raw
ifchecks witht.Fatal/t.Errorf - Prefer table-driven tests for similar cases
- Prefer specific assertions (
Equal,Contains,NoError) overTrue/False
Concurrency
- Goroutine leaks (no cleanup path, missing context cancellation)
- Shared state without synchronization
- Channel misuse (sends on closed channels, unbuffered channels in wrong contexts)
Docker/container patterns
- The CLI uses the Docker Go SDK. Watch for leaked clients, unclosed response bodies
- Dockerfile generation is in
pkg/dockerfile/-- template injection risks
Architecture
- Commands belong in
pkg/cli/, business logic inpkg/ - Config parsing/validation in
pkg/config/ - Don't mix CLI concerns with library logic