Skip to content

Releases: mvdan/gofumpt

v0.9.2

21 Oct 22:32
v0.9.2

Choose a tag to compare

This release moves the "clothe naked returns" rule under gofumpt -extra, following the discussion in #285.

Binaries built on go version go1.25.3 linux/amd64 with:

CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"

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

Note that this release no longer includes a sha256sums.txt asset; GitHub now provide digests natively.

v0.9.1

07 Sep 16:46
v0.9.1

Choose a tag to compare

This is a bugfix release to address a regression in detecting comment directives with special characters such as //golangcitest:config_path.

Binaries built on go version go1.25.1 linux/amd64 with:

CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"

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

v0.9.0

02 Sep 16:45
v0.9.0

Choose a tag to compare

This release is based on Go 1.25's gofmt, and requires Go 1.24 or later.

A new rule is introduced to "clothe" naked returns for the sake of clarity. While there is nothing wrong with naming results in function signatures, using lone return statements can be confusing to the reader.

Go 1.25's ignore directives in go.mod files are now obeyed; any directories within the module matching any of the patterns are now omitted when walking directories, such as with gofumpt -w ..

Module information is now loaded via Go's x/mod/modfile package rather than executing go mod edit -json, which is way faster. This should result in moderate speed-ups when formatting many directories.

Binaries built on go version go1.25.0 linux/amd64 with:

CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"

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

v0.8.0

13 Apr 22:03
v0.8.0
5e1cad6

Choose a tag to compare

This release is based on Go 1.24's gofmt, and requires Go 1.23 or later.

The following changes are included:

  • Fail with -d if formatting any file resulted in a diff - #114
  • Do not panic when a go.mod file is missing a go directive - #317

Binaries built on go version go1.24.2 linux/amd64 with:

CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v0.8.0"

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

v0.7.0

16 Aug 22:24
v0.7.0
86bffd6

Choose a tag to compare

This release is based on Go 1.23.0's gofmt, and requires Go 1.22 or later.

The following changes are included:

  • format.Options.LangVersion now requires Go version strings following go/version
  • Group internal/... imported packages as standard library - #307

Binaries built on go version go1.23.0 linux/amd64 with:

CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v0.7.0"

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

v0.6.0

28 Jan 22:39
v0.6.0
636d7a7

Choose a tag to compare

This release is based on Go 1.21's gofmt, and requires Go 1.20 or later.

The following changes are included:

  • Support go version strings from newer go.mod files - #280
  • Consider simple error checks even if they use the = operator - #271
  • Ignore //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!

v0.5.0

09 Apr 21:03
v0.5.0
fd93f1d

Choose a tag to compare

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 for vendor - #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!

v0.4.0

27 Sep 09:45

Choose a tag to compare

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:

  • Allow grouping declarations with comments - #212
  • Properly measure the length of case clauses - #217
  • Fix a few crashes found by Go's native fuzzing

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!

v0.3.1

21 Mar 10:45

Choose a tag to compare

This bugfix release resolves a number of issues:

  • Avoid "too many open files" error regression introduced by v0.3.0 - #208
  • Use the go.mod relative to each Go file when deriving flag defaults - #211
  • Remove unintentional debug prints when directly formatting files

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!

v0.3.0

22 Feb 17:27

Choose a tag to compare

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:

  • Functions should separate ) { where the indentation helps readability
  • Field lists should not have leading or trailing empty lines

The following changes are included as well:

  • Generated files are now fully formatted when given as explicit arguments
  • Prepare for Go 1.18's module workspaces, which could cause errors
  • Import paths sharing a prefix with the current module path are no longer grouped with standard library imports
  • format.Options gains a ModulePath field per the last bullet point

A special thanks to @Oiyoo for his recent contributions as well πŸŽ‰

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!