Skip to main content
All code contributions to Go go through a rigorous code review process to maintain code quality and consistency.

Code Review Configuration

The Go project uses Gerrit for code reviews. The default review branch is master.

Code Review Workflow

1

Prepare Your Change

Make your changes in a local branch based on the latest master:
git checkout master
git pull
git checkout -b my-feature
2

Write Tests

Ensure your changes include appropriate tests. Go has a strong testing culture:
go test ./...
3

Run Checks

Run all pre-submission checks:
go fmt ./...
go vet ./...
go test -race ./...
4

Commit Your Changes

Write a clear commit message following Go conventions:
git commit -m "package: brief description

Longer explanation of the change and why it's needed.

Fixes #12345"
5

Submit for Review

Push your change to Gerrit for review:
git codereview mail
6

Address Feedback

Respond to reviewer comments and update your change as needed:
# Make changes based on feedback
git commit --amend
git codereview mail
7

Approval and Submission

Once approved by reviewers, your change will be submitted to the master branch.

Review Guidelines

For Contributors

  • Be responsive: Reply to review comments promptly
  • Be open to feedback: Reviewers are helping improve the code
  • Keep changes focused: Each change should address one issue or feature
  • Write clear descriptions: Explain what and why, not just how

For Reviewers

  • Be constructive: Provide helpful suggestions, not just criticism
  • Be thorough: Check for correctness, style, and test coverage
  • Be timely: Try to review changes within a reasonable timeframe
  • Be respectful: Remember there’s a person behind the code

Code Style

Go has strong conventions for code style:

Formatting

Use go fmt to format all code automatically

Documentation

Document all exported functions, types, and packages

Naming

Follow Go naming conventions (MixedCaps, not underscores)

Testing

Write tests for all new functionality

Common Review Comments

Error Handling

// Good
if err != nil {
    return fmt.Errorf("failed to process: %w", err)
}

// Avoid
if err != nil {
    panic(err)
}

Documentation

// Good: Complete sentence starting with function name
// ProcessData analyzes the input data and returns results.
func ProcessData(data []byte) (Result, error) {

// Avoid: Incomplete or missing documentation
func ProcessData(data []byte) (Result, error) {

Additional Resources

Build docs developers (and LLMs) love