Skip to content

v0.2.0

Compare
Choose a tag to compare
@mvdan mvdan released this 10 Nov 17:09
· 95 commits to master since this release

This is gofumpt's second major release, based on Go 1.17's gofmt. The jump from Go 1.15's gofmt should bring a mild speed-up, as walking directories with filepath.WalkDir uses fewer syscalls.

gofumports is now removed, after being deprecated in v0.1.0. Its main purpose was IDE integration; it is now recommended to use gopls, which in turn implements goimports and supports gofumpt natively. IDEs which don't integrate with gopls (such as GoLand) implement goimports too, so it is safe to use gofumpt as their "format on save" command. See the installation instructions for more details.

The following formatting rules are added:

  • Composite literals should not have leading or trailing empty lines
  • No empty lines following an assignment operator
  • Functions using an empty line for readability should use a ) { line instead
  • Remove unnecessary empty lines from interfaces

Finally, the following changes are made to the gofumpt tool:

  • Initial support for Go 1.18's type parameters is added
  • The -r flag is removed in favor of gofmt -r
  • The -s flag is removed as it is always enabled
  • Vendor directories are skipped unless given as explicit arguments
  • The added rules are not applied to generated Go files
  • The format Go API now also applies the gofmt -s simplification
  • Add support for //gofumpt:diagnose comments

Binaries built on go version go1.17.3 linux/amd64 via a shell script.

Consider becoming a sponsor if you benefit from the work that went into this release!