---
name: gofmt
description: "Use when adopting gofmt to assess this standard: Keep Go code in canonical form"
---

# Apply gofmt

List tracked Go files whose format differs from gofmt output. Have CI check that the list is empty and exclude generated files only by explicit policy.

## Procedure

1. Inspect the repository configuration and identify the files or targets covered by gofmt.
2. Use gofmt in this repository to meet this standard: Keep Go code in canonical form. List tracked Go files whose format differs from gofmt output. Have CI check that the list is empty and exclude generated files only by explicit policy. Inspect the repository configuration, record the baseline and exact reproduction steps, then add the smallest repeatable check that detects a regression.
3. Record the tool version, configuration, scope and findings. Explain any checks that could not run.
4. Use the same invocation after changes and compare the evidence against the baseline.

Refer to [the upstream documentation](https://pkg.go.dev/cmd/gofmt) for configuration and prerequisites.
