liveBook · Manning

Style guide

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

A document that defines conventions and rules for writing source code in a consistent style.

As a team grows, inconsistent formatting makes code harder to read and lets avoidable quality problems pass unnoticed. A style guide establishes shared rules for how code looks, feels, and is documented, so teammates can focus on behavior rather than personal preferences. section 1.3.4 section 5.3

A practical style guide can standardize:

  • Formatting choices such as tabs versus spaces, bracket placement, and spacing between functions. section 5.3
  • Documentation, established implementation patterns, and tests that make code easier for teammates to understand and maintain. section 5.3
  • Automated enforcement through formatters, linters, and checks that run before or alongside testing. section 1.3.4 section 5.3

Formatting as a delivery check

A Go project can make formatting a small, repeatable pipeline step. Developers run `go fmt ./...`, while a Makefile check uses `test -z $$(go fmt ./...)` to fail when formatting would change files. A CI job named “Check formatting” can run that check before the test job, preventing inconsistent code from moving toward deployment.

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

How deep it goes
Defines formatting, documentation, patterns, and tests, then shows formatter and CI enforcement without developing a full linting system.
Examples
Uses Go formatting, a Makefile check, and a CI pipeline that requires formatting before tests.
What it assumes
Assumes basic software development and team collaboration while teaching shared conventions and their automated enforcement.
What you can do after
Apply it via formatters, linters, repository checks, and CI gates that keep team code consistent.
How it connects
Connects code formatting with linting, documentation, testing, code review, and continuous integration.

Also explained in

Compare how 10 books explain style guide →

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.