---
date: 2026-02-19
section: 1
title: GO-FMT
header: Go programming tools and commands
footer: Go 1.26
---

# NAME

go-fmt - gofmt (reformat) package sources

# SYNOPSIS

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

# DESCRIPTION

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 help packages'.

The **-n** flag prints commands that would be executed. The **-x** flag
prints commands as they are executed.

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.

# SEE ALSO

**go fix**(1), **go vet**(1).

# AUTHOR

This manual page was created using help2man and afterwards updating the
output. It is maintained by the Debian Go Compiler Team
\<team+go-compiler@tracker.debian.org\> for the Debian project (and may
be used by others).
