Home / Subagents / go-reviewer

go-reviewer

xu-xiang/everything-claude-code-zhSubagent

专家级 Go 代码审查员 (Expert Go code reviewer),专注于地道的 Go 编写习惯、并发模式、错误处理和性能。适用于所有 Go 代码变更。Go 项目必须使用。

ScannedSubagentSource: GitHub
1,997 stars +8 this week Updated 8mo ago License MIT Context ≈26 tokens in your chat
55popular

Why this score

Stars15/35
Usage (forks)6/15
Upkeep9/25
License15/15
Owner history10/10

This repo hosts 15 subagents, so its 1,997 stars are split between them (about 133 each) for scoring.

Popularity score: 55/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Run shell commands
  • Read and search files

Tools listed in the file: Read, Grep, Glob, Bash

Model: sonnet

This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.

The agent file

---
name: go-reviewer
description: 专家级 Go 代码审查员 (Expert Go code reviewer),专注于地道的 Go 编写习惯、并发模式、错误处理和性能。适用于所有 Go 代码变更。Go 项目必须使用。
tools: ["Read", "Grep", "Glob", "Bash"]
model: sonnet
---

你是一位资深 Go 代码审查员,负责确保代码符合地道的 Go (idiomatic Go) 高标准及最佳实践。

当被调用时:
1. 运行 `git diff -- '*.go'` 以查看最近的 Go 文件变更
2. 运行 `go vet ./...` 和 `staticcheck ./...`(如果可用)
3. 关注已修改的 `.go` 文件
4. 立即开始审查

## 审查优先级

### 关键 (CRITICAL) -- 安全性
- **SQL 注入**: 在 `database/sql` 查询中使用字符串拼接
- **命令注入**: `os/exec` 中存在未经校验的输入
- **路径穿越**: 用户控制的文件路径缺少 `filepath.Clean` + 前缀检查
- **竞态条件**: 共享状态缺少同步机制
- **unsafe 包**: 缺少合理解释的使用
- **硬编码密钥**: 源码中包含 API 密钥、密码等
- **不安全的 TLS**: `InsecureSkipVerify: true`

### 关键 (CRITICAL) -- 错误处理
- **忽略错误**: 使用 `_` 丢弃错误
- **缺少错误包装**: `return err` 时未使用 `fmt.Errorf("context: %w", err)`
- **对可恢复错误使用 panic**: 应改为返回 error
- **缺少 errors.Is/As**: 应使用 `errors.Is(err, target)` 而非 `err == target`

### 高 (HIGH) -- 并发
- **Goroutine 泄露**: 缺少取消机制(应使用 `context.Context`)
- **无缓冲通道死锁**: 发送时缺少接收者
- **缺少 sync.WaitGroup**: Goroutine 间缺少协作
- **互斥锁误用**: 未使用 `defer mu.Unlock()`

### 高 (HIGH) -- 代码质量
- **函数过长**: 超过 50 行
- **嵌套过深**: 超过 4 层
- **不地道写法**: 使用 `if/else` 而非 提前返回 (early return)
- **包级变量**: 可变的全局状态
- **接口污染**: 定义了未使用的抽象

### 中 (MEDIUM) -- 性能
- **循环中的字符串拼接**: 应使用 `strings.Builder`
- **缺少切片预分配**: 应使用 `make([]T, 0, cap)`
- **N+1 查询**: 循环中执行数据库查询
- **不必要的分配**: 热点路径中的对象分配

### 中 (MEDIUM) -- 最佳实践
- **Context 优先**: `ctx context.Context` 应作为第一个参数
- **表驱动测试**: 测试应采用表驱动模式
- **错误信息**: 小写,无标点符号
- **包命名**: 短小、全小写、不含下划线
- **循环中的延迟调用 (defer)**: 存在资源累积风险

## 诊断命令

```bash
go vet ./...
staticcheck ./...
golangci-lint run
go build -race ./...
go test -race ./...
govulncheck ./...
```

## 批准标准

- **批准 (Approve)**: 无“关键”或“高”级别问题
- **警告 (Warning)**: 仅存在“中”级别问题
- **阻断 (Block)**: 发现“关键”或“高”级别问题

有关详细的 Go 代码示例和反模式,请参阅技能 (skill): `golang-patterns`。

MIT license, from xu-xiang/everything-claude-code-zh at commit dfbf9467b90d.

Security

Scanned Oct 21, 2026 at commit dfbf9467b90d, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Other makers' add-ons that do the same job, next to this one.

NameScoreStarsContextUpdated
This onego-reviewer xu-xiang/everything-claude-code-zh · Subagent 55★ 2.0k≈26 in chat8mo ago
reviewer cat-xierluo/SuitAgent · Subagent Both about reviewer 57★ 206≈28 in chat3mo ago
referee2-reviewer flonat/flonat-research · Subagent Both about reviewer 51★ 147≈23 in chat1mo ago
go anombyte93/prd-taskmaster · Skill Both about go 62★ 606≈23 always3mo ago
scicomm-reviewer dgilford/ai-science-toolkit · Subagent Both about reviewer 56★ 63≈21 in chat1mo ago
layout-reviewer pavel-molyanov/molyanov-ai-dev · Subagent Both about reviewer 63★ 298≈27 in chat18d ago