gofumpt is a source formatter which applies a stricter set of rules than gofmt while remaining compatible with standard Go formatting.
Its output is deliberately a subset of valid gofmt formatting. Running gofmt on code already processed by gofumpt therefore should not introduce further changes.
The formatter also offers optional extra rules for projects wanting stronger stylistic consistency.
This is free and open source software.
Key Features
- Enforces a stricter and more consistent subset of gofmt formatting.
- Acts as a drop-in formatter for Go source while retaining compatibility with gofmt output.
- Applies additional formatting rules for declarations, expressions, comments and whitespace.
- Removes unnecessary parentheses where doing so remains unambiguous.
- Optional extra rules can group function parameters, clothe naked returns and balance multiline calls.
- Supports files, directory trees and source supplied through standard input.
- Can list files requiring changes, show diffs or rewrite files in place.
- Provides a reusable Go formatting package for integration into other tools.
Website: github.com/mvdan/gofumpt
Support:
Developer: Daniel Martí
License: BSD 3-Clause License
gofumpt is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| Go Linters | |
|---|---|
| revive | Designed as a drop-in replacement for golint |
| golangci-lint | Fast Go linters runner |
| gosec | Security scanner for Go projects |
| Staticcheck | Advanced Go linter |
| go-critic | Opinionated Go source code linter |
| Vet | Examines Go source code and reports suspicious constructs |
| gofumpt | Stricter gofmt |
| gofmt | Formats Go programs |
| goconst | Find repeated Go literals that could be replaced with constants |
| go-ruleguard | Analysis-based Go linter that runs dynamically loaded rules |
| sloglint | Enforce consistent structured logging conventions in Go |
| forbidigo | Go linter for forbidding identifiers |
| godot | Keep source code comments consistent |
| Godoc-Lint | Enforce consistent documentation comments in Go code |
| exhaustive | Check Go switch statements for missing enum cases |
Read our verdict in the software roundup.
| Go Code Formatters | |
|---|---|
| goimports-reviser | Sorts and groups imports by standard, third-party and project packages |
| gofumpt | Enforces stricter styling rules for cleaner, consistent source |
| gofmt | Applies standardised indentation, spacing and source layout |
| golines | Breaks lengthy statements into readable, shorter lines |
| goimports | Automatically adds missing imports and removes unused ones |
| gocondense | Combines multiline constructs to reduce unnecessary vertical space |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.