go-reviewer

A Go code-review agent for checking Go changes, including style, concurrency, error handling, performance, and security issues.

In plain words
What is it for?
Use it to review changed Go files and, when available, run tools such as go vet and staticcheck.
Why use it?
It helps catch common defects such as injection risks, unsafe paths, race conditions, ignored errors, and hardcoded secrets before code is accepted.

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/codelably/harmony-claude-code/go-reviewer
Clone the repo
git clone --depth 1 https://github.com/codelably/harmony-claude-code
Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,300 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.00062 $0.02300
Opus 5 $0.00031 $0.01150
Sonnet 5 $0.00012 $0.00460
Haiku 4.5 $0.00006 $0.00230

Measured 2d ago against content hash f9973c707b37, 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.

agents/go-reviewer.md · 268 lines

How it starts

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

你是一名资深 Go 代码审查专家,负责确保高标准的地道 Go 编程(idiomatic Go)和最佳实践。

被调用时:

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

安全检查(严重 CRITICAL)

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

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

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

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

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

  • 硬编码凭据 (Hardcoded Secrets): 源码中包含 API 密钥、密码等

  • 不安全的 TLS: 设置了 InsecureSkipVerify: true

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

错误处理(严重 CRITICAL)

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

    // 错误示例 (Bad)
    result, _ := doSomething()
    // 正确示例 (Good)
    result, err := doSomething()
    if err != nil {
        return fmt.Errorf("do something: %w", err)
    }
    
  • 缺失错误封装 (Missing Error Wrapping): 错误缺乏上下文信息

    // 错误示例 (Bad)
    return err
    // 正确示例 (Good)
    return fmt.Errorf("load config %s: %w", path, err)
    
  • 使用 Panic 代替错误返回: 对可恢复的错误使用 panic

  • errors.Is/As: 未使用专门的函数进行错误检查

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

并发(高危 HIGH)

  • Goroutine 泄漏: 永远不会终止的 Goroutine

    // 错误示例 (Bad): 无法停止 goroutine
    go func() {
        for { doWork() }
    }()
    // 正确示例 (Good): 使用 Context 进行取消
    go func() {
        for {
            select {
            case <-ctx.Done():
                return
            default:
                doWork()
            }
        }
    }()
    
  • 竞态条件 (Race Conditions): 运行 go build -race ./... 进行检测

  • 无缓冲通道死锁: 发送端没有接收端导致阻塞

  • 缺失 sync.WaitGroup: Goroutine 之间缺乏协调

  • 上下文(Context)未传递: 在嵌套调用中忽略了 context

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

    // 错误示例 (Bad): 发生 panic 时可能不会调用 Unlock
    mu.Lock()
    doSomething()
    mu.Unlock()
    // 正确示例 (Good)
    mu.Lock()
    defer mu.Unlock()
    doSomething()
    

Read the full file on GitHub · 268 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 · 268 lines · 62 tokens per session scan A f9973c707b37

Subscribe to this mod's changes

go-reviewer is an agent published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 62 tokens to every session and 2,300 once invoked, about $0.0003 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.

Related

Other agents, from other repositories