liveBook · Manning

Gofmt

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

The standard Go source-code formatter that applies the language's canonical formatting conventions.

gofmt is Go’s built-in formatter. It applies shared conventions automatically, moving brackets, replacing spaces with tabs, and consolidating spacing so developers can focus on behavior instead of style debates. section 5.3

Formatting as a merge gate

A Makefile target runs test -z $$(go fmt ./...), and a pull-request pipeline invokes that target before tests. A developer receives fast feedback instead of discovering formatting problems after merge.

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

How deep it goes
Explains visible formatting changes and CI enforcement, but does not detail formatter internals.
Examples
Uses go fmt ./..., a Makefile check-format target, and a pull-request format-check job.
What it assumes
Assumes a Go project and basic repository automation, while treating formatting conventions as handled by the built-in tool.
What you can do after
Operate/configure gofmt locally and enforce clean formatting through a CI merge gate.
How it connects
Connects formatting with linting, Makefiles, continuous integration, pull requests, and branch protection.

Also explained in

Compare how 3 books explain gofmt →

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.