| name | go-code-review |
| description | WHEN: User wants an automated first-pass code review on a PR, diff, or set of changes.
Also when asked "review this PR", "review my changes", or "what do you think of this code?"
WHEN NOT: Full project audits (use go-code-audit), or when user just wants linting (use go-lint-audit).
|
| license | MIT |
Go Code Review
Automated PR code review for Go projects. Provides first-pass review with inline comments, quality scoring, and breaking change detection.
What It Does
- Analyzes PR diff for code quality issues
- Generates inline comments on specific lines
- Produces a quality score (0-100)
- Flags breaking API changes
- Summarizes findings with actionable next steps
Steps
API Integration (Optional)
If GOPHER_GUIDES_API_KEY is set, verify it:
curl -s -H "Authorization: Bearer $GOPHER_GUIDES_API_KEY" \
https://gopherguides.com/api/gopher-ai/me
If not set, local analysis tools (go vet, staticcheck, golangci-lint) still provide comprehensive analysis. Set the key for enhanced API-powered insights. Get your key at gopherguides.com.
1. Get the Diff
gh pr diff {number}
git diff
git diff --cached
git diff main...HEAD
2. Static Analysis on Changed Files
CHANGED=$(git diff --name-only main...HEAD | grep '\.go$')
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs go vet
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs staticcheck
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs go test -race -count=1
3. Review Checklist
For each changed file, check:
Correctness
Readability
Maintainability
Performance
4. Breaking Change Detection
Check for API-breaking changes in exported symbols:
git diff main...HEAD -- '*.go' | grep -E "^-func [A-Z]|^-type [A-Z]|^-var [A-Z]|^-const [A-Z]"
Breaking changes include:
- Removed exported functions/types/methods
- Changed function signatures
- Changed struct field types
- Removed interface methods (breaks implementors)
- Changed package paths
5. Gopher Guides API Review
Note: API calls send source code to gopherguides.com for analysis. Ensure your organization's policy permits external code analysis.
For full API usage examples, see API Usage Reference.
Severity Configuration
After installation via install.sh, review findings use severity levels from .github/skills/config/severity.yaml. See the Setup Guide for details.
Output Format
## Code Review Summary
**PR:** #{number} — {title}
**Files Changed:** {count}
**Quality Score:** {score}/100
### 🔴 Must Fix ({n})
Issues that should be addressed before merge.
1. **`file.go:{line}`** — {issue}
```go
// suggestion
🟡 Should Fix ({n})
Issues that improve code quality.
file.go:{line} — {issue}
🟢 Nit ({n})
Minor style or preference items.
file.go:{line} — {issue}
⚠️ Breaking Changes
{list of breaking API changes, or "None detected"}
✅ What Looks Good
{positive feedback on well-written code}
Tests
Recommendation
{APPROVE | REQUEST_CHANGES | COMMENT}
{brief summary of overall assessment}
## Quality Score Rubric
| Criteria | Points | Description |
|----------|--------|-------------|
| Error Handling | 20 | All errors checked and wrapped |
| Test Coverage | 20 | New code has tests |
| Naming/Style | 15 | Idiomatic Go conventions |
| Documentation | 15 | Exported symbols documented |
| Complexity | 15 | Functions focused, readable |
| Safety | 15 | No races, leaks, or panics |
## References
- Existing gopher-ai command: `plugins/go-workflow/commands/address-review.md`
- Gopher Guides API: `plugins/gopher-guides/skills/gopher-guides/`
- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
---
*Powered by [Gopher Guides](https://gopherguides.com) training materials.*