This release is based on Go 1.20's gofmt, and requires Go 1.19 or later.
The biggest change in this release is that we now vendor copies of the packages go/format
, go/printer
, and go/doc/comment
on top of cmd/gofmt
itself. This allows for each gofumpt release to format code in exactly the same way no matter what Go version is used to build it, as Go versions can change those three packages in ways that alter formatting behavior.
This vendoring adds a small amount of duplication when using the mvdan.cc/gofumpt/format
library, but it's the only way to make gofumpt versions consistent in their behavior and formatting, just like gofmt.
The jump to Go 1.20's go/printer
should also bring a small performance improvement, as we contributed patches to make printing about 25% faster:
The following changes are included as well:
- Skip
testdata
dirs by default like we already do forvendor
- #260 - Avoid inserting newlines incorrectly in some func signatures - #235
- Avoid joining some comments with the previous line - #256
- Fix
gofumpt -version
for release archives - #253
Binaries built on go version go1.20.3 linux/amd64
with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v0.5.0"
Consider becoming a sponsor if you benefit from the work that went into this release!