Enforce a stricter format than gofmt, while being backward compatible. That is, gofumpt is happy with a subset of the formats that gofmt is happy with. The tool is a fork of gofmt as of Go 1.19, and requires Go 1.18 or later. It can be used as a drop-in replacement to format your Go code, and running gofmt after gofumpt should produce no changes. Some of the Go source files in this repository belong to the Go project. The project includes copies of go/printer and go/doc/comment as of Go 1.19 to ensure consistent formatting independent of what Go version is being used. The added formatting rules are implemented in the format package. Note that vendor directories are skipped unless given as explicit arguments. Similarly, the added rules do not apply to generated Go files unless they are given as explicit arguments.

Features

  • No empty lines following an assignment operator
  • Functions should separate ) { where the indentation helps readability
  • Composite literals should use newlines consistently
  • Empty field lists should use a single line
  • std imports must be in a separate group at the top
  • Short case clauses should take a single line

Project Samples

Project Activity

See All Activity >

Categories

Frameworks

License

BSD License

Follow gofumpt

gofumpt Web Site

Other Useful Business Software
Build Securely on AWS with Proven Frameworks Icon
Build Securely on AWS with Proven Frameworks

Lay a foundation for success with Tested Reference Architectures developed by Fortinet’s experts. Learn more in this white paper.

Moving to the cloud brings new challenges. How can you manage a larger attack surface while ensuring great network performance? Turn to Fortinet’s Tested Reference Architectures, blueprints for designing and securing cloud environments built by cybersecurity experts. Learn more and explore use cases in this white paper.
Download Now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of gofumpt!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Related Categories

Go Frameworks

Registered

2023-01-24