LinuxCommandLibrary

gofumpt

Stricter Go code formatter

TLDR

Format file

$ gofumpt [file.go]
copy
Format in place
$ gofumpt -w [file.go]
copy
Format directory
$ gofumpt -w .
copy
Check formatting
$ gofumpt -d [file.go]
copy
Extra formatting rules
$ gofumpt -extra [file.go]
copy

SYNOPSIS

gofumpt [options] [files]

DESCRIPTION

gofumpt is a stricter alternative to gofmt that applies additional formatting rules beyond the standard Go style. It removes unnecessary blank lines, enforces consistent grouping, and applies other style preferences while remaining a superset of gofmt.
The -extra flag enables even more opinionated rules for tighter code formatting.

PARAMETERS

FILES

Go files to format.
-w
Write to file.
-d
Show diff.
-s
Simplify code.
-extra
Enable extra rules.
--help
Display help information.

CAVEATS

Stricter than gofmt. May conflict with project style. Configure editors accordingly.

HISTORY

gofumpt was created by Daniel Marti to provide stricter formatting than standard gofmt.

SEE ALSO

gofmt(1), go-fmt(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community