go-review

A Go-specific code review command that checks changed Go files for style, errors, concurrency problems, security issues, and common defects.

In plain words
What is it for?
Use it after changing Go code, before submitting a pull request, or when taking over or learning an unfamiliar Go codebase.
Why use it?
It combines automated checks with a focused review so problems such as race conditions, injection risks, and ignored errors are easier to find before release.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/luohaothu/everything-codex/go-review
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 956 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.00956
Opus 5 $0.00015 $0.00478
Sonnet 5 $0.00006 $0.00191
Haiku 4.5 $0.00003 $0.00096

Measured 2d ago against content hash fd175b65c887, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

go-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/zh-CN/commands/go-review.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go 代码审查

此命令调用 go-reviewer 代理进行全面的 Go 语言特定代码审查。

此命令的作用

  1. 识别 Go 变更:通过 git diff 查找修改过的 .go 文件
  2. 运行静态分析:执行 go vetstaticcheckgolangci-lint
  3. 安全扫描:检查 SQL 注入、命令注入、竞态条件
  4. 并发性审查:分析 goroutine 安全性、通道使用、互斥锁模式
  5. 惯用 Go 检查:验证代码是否遵循 Go 约定和最佳实践
  6. 生成报告:按严重程度分类问题

使用时机

在以下情况使用 /go-review

  • 编写或修改 Go 代码之后
  • 提交 Go 变更之前
  • 审查包含 Go 代码的拉取请求时
  • 接手新的 Go 代码库时
  • 学习惯用 Go 模式时

审查类别

严重(必须修复)

  • SQL/命令注入漏洞
  • 无同步的竞态条件
  • Goroutine 泄漏
  • 硬编码凭证
  • 不安全的指针使用
  • 关键路径中忽略的错误

高(应该修复)

  • 缺少带上下文的错误包装
  • 使用 panic 而非返回错误
  • 上下文未传播
  • 无缓冲通道导致死锁
  • 接口未满足错误
  • 缺少互斥锁保护

中(考虑修复)

  • 非惯用代码模式
  • 导出项缺少 godoc 注释
  • 低效的字符串拼接
  • 切片未预分配
  • 未使用表格驱动测试

运行的自动化检查

# Static analysis
go vet ./...

# Advanced checks (if installed)
staticcheck ./...
golangci-lint run

# Race detection
go build -race ./...

# Security vulnerabilities
govulncheck ./...

使用示例

User: /go-review

Agent:
# Go Code Review Report

## Files Reviewed
- internal/handler/user.go (modified)
- internal/service/auth.go (modified)

## Static Analysis Results
✓ go vet: No issues
✓ staticcheck: No issues

## Issues Found

[CRITICAL] Race Condition
File: internal/service/auth.go:45
Issue: Shared map accessed without synchronization
```go
var cache = map[string]*Session{}  // Concurrent access!

func GetSession(id string) *Session {
    return cache[id]  // Race condition
}

修复:使用 sync.RWMutex 或 sync.Map

var (
    cache   = map[string]*Session{}
    cacheMu sync.RWMutex
)

func GetSession(id string) *Session {
    cacheMu.RLock()
    defer cacheMu.RUnlock()
    return cache[id]
}

[高] 缺少错误上下文 文件:internal/handler/user.go:28 问题:返回的错误缺少上下文

return err  // No context

修复:使用上下文包装

return fmt.Errorf("get user %s: %w", userID, err)

摘要

  • 严重:1
  • 高:1
  • 中:0

建议:❌ 在严重问题修复前阻止合并


## Approval Criteria

| Status | Condition |
|--------|-----------|
| ✅ Approve | No CRITICAL or HIGH issues |
| ⚠️ Warning | Only MEDIUM issues (merge with caution) |
| ❌ Block | CRITICAL or HIGH issues found |

Read the full file on GitHub · 162 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 162 lines · 30 tokens per session scan A fd175b65c887

Subscribe to this mod's changes

go-review is a command published in the GitHub repository Luohaothu/everything-codex (24 stars, last pushed 22d ago), licensed MIT. It adds 30 tokens to every session and 956 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.