A stricter gofmt
This release is based on Go 1.21's gofmt, and requires Go 1.20 or later.
The following changes are included:
go
version strings from newer go.mod files - #280
=
operator - #271
//line
directives to avoid panics - #288
Binaries built on go version go1.21.6 linux/amd64
with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v0.6.0"
Consider becoming a sponsor if you benefit from the work that went into this release!
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:
testdata
dirs by default like we already do for vendor
- #260
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!
This release is based on Go 1.19's gofmt, and requires Go 1.18 or later. We recommend building gofumpt with Go 1.19 for the best formatting results.
The jump from Go 1.18 brings diffing in pure Go, removing the need to exec diff
,
and a small parsing speed-up thanks to go/parser.SkipObjectResolution
.
The following formatting fixes are included as well:
Binaries built on go version go1.19.1 linux/amd64
via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!
This bugfix release resolves a number of issues:
go.mod
relative to each Go file when deriving flag defaults - #211
Binaries built on go version go1.18 linux/amd64
via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!
This is gofumpt's third major release, based on Go 1.18's gofmt. The jump from Go 1.17's gofmt should bring a noticeable speed-up, as the tool can now format many files concurrently. On an 8-core laptop, formatting a large codebase is 4x as fast.
The following formatting rules are added:
) {
where the indentation helps readabilityThe following changes are included as well:
format.Options
gains a ModulePath
field per the last bullet pointA special thanks to @Oiyoo for his recent contributions as well :tada:
Binaries built on go version go1.17.7 linux/amd64
via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!
This bugfix release resolves a number of issues:
-s
and -r
once again, now giving useful errorsBinaries built on go version go1.17.5 linux/amd64
via a shell script.
Consider becoming a sponsor if you benefit from the work that went into 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:
) {
line insteadFinally, the following changes are made to the gofumpt tool:
-r
flag is removed in favor of gofmt -r
-s
flag is removed as it is always enabledformat
Go API now also applies the gofmt -s
simplification//gofumpt:diagnose
commentsBinaries 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!
This bugfix release backports fixes for a few issues:
//go-sumtype:
directivesBinaries built on go version go1.16.1 linux/amd64
via a shell script.
This is gofumpt's first release, based on Go 1.15.x. It solidifies the features which have worked well for over a year.
This release will be the last to include gofumports
, the fork of goimports
which applies gofumpt
's rules on top of updating the Go import lines. Users who were relying on goimports
in their editors or IDEs to apply both gofumpt
and goimports
in a single step should switch to gopls, the official Go language server. It is supported by many popular editors such as VS Code and Vim, and already bundles gofumpt support. Instructions are available in the README.
gofumports
also added maintenance work and potential confusion to end users. In the future, there will only be one way to use gofumpt
from the command line. We also have a Go API for those building programs with gofumpt.
Finally, this release adds the -version
flag, to print the tool's own version. The flag will work for "master" builds too.
Binaries built on go version go1.15.6 linux/amd64
via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!