mit einem Klick
go-code-review
// Reviews Go code for idiomatic patterns, error handling, concurrency safety, and common mistakes. Use when reviewing .go files, checking error handling, goroutine usage, or interface design.
// Reviews Go code for idiomatic patterns, error handling, concurrency safety, and common mistakes. Use when reviewing .go files, checking error handling, goroutine usage, or interface design.
Find functions with high cyclomatic complexity, excessive length, or too many parameters. Use when the user asks to find complex code, complexity hotspots, refactoring candidates, or wants to improve code maintainability.
Find unused functions, types, constants, imports, and unreachable code paths. Use when the user asks to find dead code, unused code, cleanup candidates, or wants to reduce codebase size.
Find code duplication in the codebase. Supports two modes - scoped to current branch changes or a full codebase sweep. Use when the user asks to find duplicated code, copy-paste, repeated patterns, or wants to deduplicate before a PR.
Reviews Go test code for proper table-driven tests, assertions, and coverage patterns. Use when reviewing *_test.go files.
Investigate CI/Prow job failures on a GitHub pull request. Use when the user pastes a PR URL and asks about CI failures, red checks, test failures, or wants to understand why a job failed.
Performs a strict clean rebase of a feature branch onto main with minimal conflict resolution and full validation. Use when the user asks to rebase carefully, avoid extra branches, avoid exploratory edits, and run go test and go vet until green.
| name | go-code-review |
| description | Reviews Go code for idiomatic patterns, error handling, concurrency safety, and common mistakes. Use when reviewing .go files, checking error handling, goroutine usage, or interface design. |
| Issue Type | Reference |
|---|---|
| Missing error checks, wrapped errors | references/error-handling.md |
| Race conditions, channel misuse | references/concurrency.md |
| Interface pollution, naming | references/interfaces.md |
| Resource leaks, defer misuse | references/common-mistakes.md |
_ = err)fmt.Errorf("...: %w", err))defer immediately after creation-er (Reader, Writer, Handler)controllerutil.SetControllerReference()apiequality.Semantic.DeepEqual)ctrl.Result{Requeue: true} for transient issues, errors for permanent failures//+kubebuilder:rbac) present for all resource access in controllersThese patterns are acceptable and should NOT be flagged as issues:
_ = err with reason comment - Intentionally ignored errors with explanation
_ = conn.Close() // Best effort cleanup, already handling primary error
interface{} - For truly generic code (pre-generics codebases)//nolint directives with reason - Acceptable when accompanied by explanation
//nolint:errcheck // Error logged but not returned per API contract
Only flag these issues when the specific conditions apply:
| Issue | Flag ONLY IF |
|---|---|
| Missing error check | Error return is actionable (can retry, log, or propagate) |
| Goroutine leak | No context cancellation path exists for the goroutine |
| Missing defer | Resource isn't explicitly closed before next acquisition or return |
| Interface pollution | Interface has > 1 method AND only one consumer exists |