go-fmt(1)

go-fmt1

Gofmt (reformat) package sources

Usage

go fmt [-n] [-x] [packages]

Overview

Fmt runs the command ‘gofmt -l -w’ on the packages named by the import paths. It prints the names of the files that are modified.

For more about gofmt, see ‘go doc cmd/gofmt’.
For more about specifying packages, see go-packages(7).

-n

The -n flag prints commands that would be executed.

-x

The -x flag prints commands as they are executed.

-mod

The -mod flag’s value sets which module download mode to use: readonly or vendor. See ‘go help modules’ for more.

To run gofmt with specific options, run gofmt itself.

Releases

7 releases since Debian 7 (Wheezy); the text changed 1 time.

  1. 7–11
  2. 12–13

-mod since Debian 12 (Bookworm).

Author

This manual page was written by Michael Stapelberg <[email protected]> and is maintained by the Debian Go Compiler Team <[email protected]> based on the output of ‘go help fmt’ for the Debian project (and may be used by others).

From gccgo-go 2:1.24~2 in Debian 13 (Trixie). Also shipped by golang-go. Parsed by carta from the page's man source.