Skip to main content

go-review

Go code review guidelines for the Cog codebase

来源信息

仓库
replicate/cog
最近来源活动
2026年4月24日 19:38
检测到的 SKILL.md 语言
英语
星标
9,489
分支
698

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
go-review
description
Go code review guidelines for the Cog codebase
## Go review guidelines This project uses Go for the CLI (`cmd/cog/`, `pkg/`) and support tooling (`tools/`). ### What linters already catch (skip these) golangci-lint runs errcheck, gocritic, gosec, govet, ineffassign, misspell, revive, staticcheck, and unused. Don't flag issues these would catch. ### What to look for **Error handling** - Errors returned but not checked or silently discarded - User-facing errors should use `pkg/errors.CodedError` with error codes - Generic error wrapping that loses context (`fmt.Errorf("failed")` with no `%w`) **Imports** - Should be three groups: stdlib, third-party, internal (`github.com/replicate/cog/pkg/...`) - Only flag if actually wrong, not cosmetic reordering **Testing** - Must use `testify/require` for fatal assertions and `testify/assert` for non-fatal - No raw `if` checks with `t.Fatal`/`t.Errorf` - Prefer table-driven tests for similar cases - Prefer specific assertions (`Equal`, `Contains`, `NoError`) over `True`/`False` **Concurrency** - Goroutine leaks (no cleanup path, missing context cancellation) - Shared state without synchronization - Channel misuse (sends on closed channels, unbuffered channels in wrong contexts) **Docker/container patterns** - The CLI uses the Docker Go SDK. Watch for leaked clients, unclosed response bodies - Dockerfile generation is in `pkg/dockerfile/` -- template injection risks **Architecture** - Commands belong in `pkg/cli/`, business logic in `pkg/` - Config parsing/validation in `pkg/config/` - Don't mix CLI concerns with library logic
在 GitHub 查看