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.
goimportsused by · goimports is a Go source-code formatter that formats code and adds, removes, or organizes import declarations based on usage.
formattingimplements · Formatting is the arrangement or transformation of content, data, or code according to specified structural, stylistic, or presentation conventions.
Goconfigures · Go is a statically typed, compiled, garbage-collected programming language with built-in support for concurrency.
go commandpart of · The go command is Go’s standard command-line interface for compiling, building, testing, formatting, analyzing, and managing Go programs and dependencies.
style guideimplements · A style guide is a documented set of conventions for consistently formatting, naming, organizing, or presenting source code.
build taguses · A build tag is a Go source-file constraint that determines whether a file is included in a particular build configuration.
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.