liveBook · Manning

Code review

As explained in Shipping Go: Develop, deliver, discuss, design, and go again

A code review process is a defined process for examining source code to assess its quality and provide feedback.

A change can pass its tests and still benefit from another developer’s attention. Code review gives the team a chance to examine a change, ask questions, share techniques, and accept responsibility for what enters the repository. A pull request holds the change for that review before it is merged. section 5.1 section 5.1.2

Make the review process useful without letting it stall delivery:

  • Protect the main branch from direct commits. Require one approval and passing checks before a pull request can merge; administrators are an exception to the direct-commit restriction. section 5.1
  • Keep changes small. Aim for no more than 300 lines, including tests, so reviewers can focus and changes can merge often. Treat the limit as guidance, not a rigid rule. section 5.1.1
  • Discuss the code, not the developer. Ask questions, accept feedback, check that the change works, and move extended disagreements out of comment threads. section 5.1.2
  • Make time for reviews each day. Code waiting for approval is work in progress, not value delivered to a customer; politely tell teammates when you are waiting. section 5.1.3

Split a large change

Rather than asking someone to inspect a 2,000-line change at once, break the task into roughly ten reviews of 200 lines. Each review gives the team a smaller opportunity to spot problems and merge useful work. section 5.1.1

Figure 5.1 Setting up branch protection in GitHub Repo

Use the GitHub branch-protection setup as a guide when configuring the protected branch, required review, and passing checks. section 5.1

Keep improving the process with the team. Questions, refactoring challenges, or fresh approaches to unit tests can make repeated reviews more engaging. The operational goal is a steady flow of small, checked changes—and a team that learns from reviewing them. section 5.1.4 section 5.1.1

How Shipping Go: Develop, deliver, discuss, design, and go again covers it

How deep it goes
Gives configuration steps and practical rules for review size, conduct, and timing rather than a line-by-line inspection checklist.
Examples
Illustrates review size by splitting a 2,000-line change into about ten 200-line reviews.
What it assumes
Builds on repository and branch basics while explaining pull requests through a shipment sign-off analogy.
What you can do after
Operate/configure GitHub branch protection to require another person’s approval and passing checks before merging.
How it connects
Connects code review to branch protection, pull requests, automated checks, trunk-based development, and work in progress.

Also explained in

Compare how 10 books explain code review →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Shipping Go: Develop, deliver, discuss, design, and go again. The section links point to the parts of the book it draws on.