Comprehensive guide to code review checklist covering architecture, implementation, testing, and operational patterns for production engineering teams.
Code reviews are the primary checkpoint for software quality, alignment, and knowledge sharing. They matter most during feature development, bug fixes, refactoring, and onboarding new contributors. This checklist guides reviewers and authors through the essential steps of a thorough, actionable review, from first glance to final approval.
Before a pull request (PR) is opened, the author should ensure it is ready for feedback. The review begins not when the PR is created, but when it is *reviewable*.
git commit -m "Add user authentication with JWT" --all to bundle related changes.git push origin feature/auth-jwt triggers a CI pipeline. The build must be green and tests must pass. A failing CI is a non-starter.Closes #42, Fixes #103.make dev and navigate to /login. Use user:[email protected], pass:secret.”*The reviewer begins with a quick pass to assess scope, clarity, and correctness. This phase takes 15–30 minutes and sets the tone for deeper feedback.
git diff --name-status HEAD~1 to verify no unintended changes.main.go, routes.go, config.go, and README.md.find . -name "*.go" | xargs grep -l "type.*[A-Z]" to spot inconsistent naming.internal/auth, internal/api, and pkg/config are used appropriately.config.yaml file should use auth.jwt.secret and auth.jwt.expiry, not jwt_secret or auth.expiry.git grep -n "func.*\s*{\n\s*.*\n\s*}" to find function bodies.nil checks, boundary values, and error propagation. For example: if err := db.QueryRow("SELECT * FROM users WHERE id = $1", userID).Scan(&user); err != nil {
return nil, fmt.Errorf("failed to fetch user: %w", err)
}
context.Context is passed through all functions, especially in HTTP handlers: func (s *UserService) CreateUser(ctx context.Context, user *User) error {
// Use ctx in database calls and logging
log.Printf(ctx, "Creating user %s", user.Email)
// ...
}
if err != nil { ... } blocks without return or log.Printf.fmt.Errorf or errors.Wrap, not just fmt.Sprintf.user_test.go for user.go. go test -v ./...
TestUserAPI that spins up a server and makes HTTP requests.go test -coverprofile=cover.out ./... && go tool cover -html=cover.out -o cover.htmlTestCreateUser_InvalidEmail_ReturnsError, not Test1.testdata/ directory with input files, JSON, or SQL dumps.log.Printf or slog calls at key steps: start := time.Now()
defer func() {
log.Printf("Processing user: %s took %v", user.Email, time.Since(start))
}()
pprof annotations or profiling enabled in main.go: go func() {
log.Println(http.ListenAndServe("localhost:6060", pprof.Handler()))
}()
prometheus.MustRegister calls and prometheus.NewCounterVec usage.Dockerfile is updated and docker build produces a correct image.docker-compose.yml includes new services and correct environment variables.config.yaml includes all required fields: auth:
jwt:
secret: "super-secret-key"
expiry: 24h
issuer: "auth-service"
logging:
level: "info"
format: "json"
README.md or docs/env.md listing:AUTH_JWT_SECRETDB_HOSTREDIS_URLuser, userID, db, authHandler, validateToken. // This timeout ensures that users don’t see stale data during peak load.
// We chose 30s because the cache is invalidated every 25s.
const cacheTTL = 30 * time.Second
if len(data) > 1000 { ... } without extracting logic to a helper.if err := ...; err != nil { if ... { ... } }.go vet should be run.Feedback should be specific, actionable, and prioritized. Use the PR comment interface with clear, concise messages.
for loop: *“Add a comment explaining the purpose of the loop.”*if err != nil: *“Consider using errors.Wrap instead of fmt.Errorf.”*log.Printf to slog.Info to match the rest of the codebase.”*/health endpoint.”*user.GetByID(ctx, id) method.”*After feedback is addressed, the reviewer finalizes the review.
LGTM! All feedback addressed. The implementation is clean and well-documented.
Merging now.
git checkout main
git pull origin main
git merge --squash feature/auth-jwt
git commit -m "feat(auth): add JWT authentication
"
git push origin main
git checkout feature/auth-jwt
git rebase main
git checkout main
git merge feature/auth-jwt
git push origin main
git checkout main
git merge feature/auth-jwt
git push origin main
git tag v1.2.0 -m "Release 1.2.0: JWT auth, improved logging"
git push origin v1.2.0
CHANGELOG.md: ## [1.2.0] - 2025-04-05
### Features
- Add JWT-based authentication ([#42])
- Add health check endpoint ([#103])
### Improvements
- Improve error logging with structured output
go fmt not applied leads to inconsistent code style.make lint is run, but golint is not installed locally.config.yaml is added, but config.yaml.example is not updated.context.WithTimeout and context.WithCancel:WithTimeout is used for deadline-based operations, WithCancel for cancellation from upstream.WithCancel in a long-running task without defer cancel() leads to leaked goroutines.log.Printf is used, but log.Printf is not prefixed with ctx or slog is not used consistently.error: failed to connect to database vs. error: failed to connect to postgres: dial tcp 10.0.0.5:5432: connection refused.testdata/ folder is missing or outdated.go test locally but not using testdata/ results in flaky tests.A code review is not just a passover of code. It is a collaborative process of shaping the system, catching bugs early, and spreading knowledge. Use this checklist to ensure every review is thorough, actionable, and focused on the right things. Start with a clear PR, validate architecture and implementation, test deeply, and close with a clear approval. Over time, consistent use of this checklist will make the codebase more robust and the team more cohesive.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy