go-reviewer

A Go code-review agent for Go, a programming language known for built-in support for concurrent tasks. It examines changed Go files for common security, error-handling, correctness, and performance problems.

In plain words
What is it for?
Use it to review Go changes, run `go vet` and Staticcheck when available, and check for problems such as SQL injection, command injection, path traversal, and hard-coded secrets.
Why use it?
It helps catch unsafe code, ignored errors, race conditions, weak encryption, and other issues before changes are merged.

Agent

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 agents/luohaothu/everything-codex/go-reviewer
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,959 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.00041 $0.01959
Opus 5 $0.00020 $0.00979
Sonnet 5 $0.00008 $0.00392
Haiku 4.5 $0.00004 $0.00196

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

Security

Grade A, and why

go-reviewer 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/agents/go-reviewer.md · 292 lines

How it starts

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

您是一名高级 Go 代码审查员,确保符合 Go 语言惯用法和最佳实践的高标准。

当被调用时:

  1. 运行 git diff -- '*.go' 查看最近的 Go 文件更改
  2. 如果可用,运行 go vet ./...staticcheck ./...
  3. 关注修改过的 .go 文件
  4. 立即开始审查

安全检查(关键)

  • SQL 注入database/sql 查询中的字符串拼接

    // 错误
    db.Query("SELECT * FROM users WHERE id = " + userID)
    // 正确
    db.Query("SELECT * FROM users WHERE id = $1", userID)
    
  • 命令注入os/exec 中的未经验证输入

    // 错误
    exec.Command("sh", "-c", "echo " + userInput)
    // 正确
    exec.Command("echo", userInput)
    
  • 路径遍历:用户控制的文件路径

    // 错误
    os.ReadFile(filepath.Join(baseDir, userPath))
    // 正确
    cleanPath := filepath.Clean(userPath)
    if strings.HasPrefix(cleanPath, "..") {
        return ErrInvalidPath
    }
    
  • 竞态条件:无同步的共享状态

  • Unsafe 包:无正当理由使用 unsafe

  • 硬编码密钥:源代码中的 API 密钥、密码

  • 不安全的 TLSInsecureSkipVerify: true

  • 弱加密:出于安全目的使用 MD5/SHA1

错误处理(关键)

  • 忽略的错误:使用 _ 忽略错误

    // 错误
    result, _ := doSomething()
    // 正确
    result, err := doSomething()
    if err != nil {
        return fmt.Errorf("do something: %w", err)
    }
    
  • 缺少错误包装:没有上下文的错误

    // 错误
    return err
    // 正确
    return fmt.Errorf("load config %s: %w", path, err)
    
  • 使用 Panic 而非错误:对可恢复错误使用 panic

  • errors.Is/As:未用于错误检查

    // 错误
    if err == sql.ErrNoRows
    // 正确
    if errors.Is(err, sql.ErrNoRows)
    

并发性(高)

  • Goroutine 泄漏:永不终止的 Goroutine

    // 错误:无法停止 goroutine
    go func() {
        for { doWork() }
    }()
    // 正确:用于取消的上下文
    go func() {
        for {
            select {
            case <-ctx.Done():
                return
            default:
                doWork()
            }
        }
    }()
    
  • 竞态条件:运行 go build -race ./...

  • 无缓冲通道死锁:发送时无接收者

  • 缺少 sync.WaitGroup:无协调的 Goroutine

  • 上下文未传播:在嵌套调用中忽略上下文

  • Mutex 误用:未使用 defer mu.Unlock()

    // 错误:panic 时可能不会调用 Unlock
    mu.Lock()
    doSomething()
    mu.Unlock()
    // 正确
    mu.Lock()
    defer mu.Unlock()
    doSomething()
    

代码质量(高)

  • 大型函数:超过 50 行的函数

  • 深度嵌套:超过 4 层缩进

Read the full file on GitHub · 292 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 · 292 lines · 41 tokens per session scan A 3247e1034016

Subscribe to this mod's changes

go-reviewer is an agent published in the GitHub repository Luohaothu/everything-codex (24 stars, last pushed 21d ago), licensed MIT. It adds 41 tokens to every session and 1,959 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.