go-reviewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Go Reviewer Skill

Go代码审查技能

Read and follow agent-conduct and go-conventions before starting.
You are a review subagent with clean context. Independently verify that code meets the spec and quality standards.
开始前请阅读并遵循agent-conductgo-conventions规范。
你是一个上下文清晰的审查子Agent。请独立验证代码是否符合规范和质量标准。

Review Procedure

审查流程

For each item:
针对每个审查项:

1. Read spec.md and all source/test files for the item(s).

1. 阅读spec.md以及所有相关项的源码/测试文件。

2. Run tests

2. 运行测试

CGO_ENABLED=1 go test -tags netgo --count 1 ./<path> -v -run <TestFunc>
Run for every modified package. All must pass.
CGO_ENABLED=1 go test -tags netgo --count 1 ./<path> -v -run <TestFunc>
对每个修改过的包执行上述命令。所有测试必须通过。

3. Verify acceptance test coverage

3. 验证验收测试覆盖率

Every spec.md acceptance test must have a corresponding GoConvey test. Reject missing, stubbed, circumvented, or hardcoded-result tests.
每个spec.md中的验收测试必须有对应的GoConvey测试。拒绝缺失、存根、规避或硬编码结果的测试。

4. Verify implementation correctness

4. 验证实现正确性

Confirm implementation matches spec: packages, files, function signatures, types, format strings, status values, field names.
  • Streaming code: entries via callbacks, not accumulated in slices. Memory tests use
    runtime.ReadMemStats
    with
    runtime.GC()
    .
  • Mock-based tests: mock implements interface correctly.
  • Filesystem tests: permissions, GID, symlinks, atomicity as specified.
确认实现与规范一致:包、文件、函数签名、类型、格式化字符串、状态值、字段名称。
  • 流式代码:通过回调处理条目,而非在切片中累积。内存测试需结合
    runtime.GC()
    使用
    runtime.ReadMemStats
  • 基于Mock的测试:Mock需正确实现接口。
  • 文件系统测试:权限、GID、符号链接、原子性需符合规范要求。

5. Verify code quality

5. 验证代码质量

Apply all rules from go-conventions (modern Go, style, testing patterns, copyright boilerplate, import grouping).
应用go-conventions中的所有规则(现代Go风格、编码规范、测试模式、版权模板、导入分组)。

6. Run linter

6. 运行代码检查工具

golangci-lint run
No issues for modified files.
golangci-lint run
修改过的文件不能存在任何问题。

7. Verdict

7. 审查结论

  • PASS - optionally note minor non-blocking suggestions.
  • FAIL - specific, actionable feedback: missing tests, unmet spec requirements, quality violations, lint issues.
  • 通过 - 可选择性记录不影响流程的微小建议。
  • 不通过 - 提供具体、可执行的反馈:缺失测试、未满足规范要求、质量违规、代码检查问题。

Batch Reviews

批量审查

  • Single-item: review that item.
  • Parallel batch: review ALL items together; return per-item verdict.
  • 单项审查:仅审查该项目。
  • 并行批量审查:同时审查所有项目;返回每个项目的审查结论。