| 1 | # Changelog |
| 2 | |
| 3 | ## [v0.6.0] - 2024-01-28 |
| 4 | |
| 5 | This release is based on Go 1.21's gofmt, and requires Go 1.20 or later. |
| 6 | |
| 7 | The following changes are included: |
| 8 | |
| 9 | * Support `go` version strings from newer go.mod files - [#280] |
| 10 | * Consider simple error checks even if they use the `=` operator - [#271] |
| 11 | * Ignore `//line` directives to avoid panics - [#288] |
| 12 | |
| 13 | ## [v0.5.0] - 2023-04-09 |
| 14 | |
| 15 | This release is based on Go 1.20's gofmt, and requires Go 1.19 or later. |
| 16 | |
| 17 | The biggest change in this release is that we now vendor copies of the packages |
| 18 | `go/format`, `go/printer`, and `go/doc/comment` on top of `cmd/gofmt` itself. |
| 19 | This allows for each gofumpt release to format code in exactly the same way |
| 20 | no matter what Go version is used to build it, as Go versions can change those |
| 21 | three packages in ways that alter formatting behavior. |
| 22 | |
| 23 | This vendoring adds a small amount of duplication when using the |
| 24 | `mvdan.cc/gofumpt/format` library, but it's the only way to make gofumpt |
| 25 | versions consistent in their behavior and formatting, just like gofmt. |
| 26 | |
| 27 | The jump to Go 1.20's `go/printer` should also bring a small performance |
| 28 | improvement, as we contributed patches to make printing about 25% faster: |
| 29 | |
| 30 | * https://go.dev/cl/412555 |
| 31 | * https://go.dev/cl/412557 |
| 32 | * https://go.dev/cl/424924 |
| 33 | |
| 34 | The following changes are included as well: |
| 35 | |
| 36 | * Skip `testdata` dirs by default like we already do for `vendor` - [#260] |
| 37 | * Avoid inserting newlines incorrectly in some func signatures - [#235] |
| 38 | * Avoid joining some comments with the previous line - [#256] |
| 39 | * Fix `gofumpt -version` for release archives - [#253] |
| 40 | |
| 41 | ## [v0.4.0] - 2022-09-27 |
| 42 | |
| 43 | This release is based on Go 1.19's gofmt, and requires Go 1.18 or later. |
| 44 | We recommend building gofumpt with Go 1.19 for the best formatting results. |
| 45 | |
| 46 | The jump from Go 1.18 brings diffing in pure Go, removing the need to exec `diff`, |
| 47 | and a small parsing speed-up thanks to `go/parser.SkipObjectResolution`. |
| 48 | |
| 49 | The following formatting fixes are included as well: |
| 50 | |
| 51 | * Allow grouping declarations with comments - [#212] |
| 52 | * Properly measure the length of case clauses - [#217] |
| 53 | * Fix a few crashes found by Go's native fuzzing |
| 54 | |
| 55 | ## [v0.3.1] - 2022-03-21 |
| 56 | |
| 57 | This bugfix release resolves a number of issues: |
| 58 | |
| 59 | * Avoid "too many open files" error regression introduced by [v0.3.0] - [#208] |
| 60 | * Use the `go.mod` relative to each Go file when deriving flag defaults - [#211] |
| 61 | * Remove unintentional debug prints when directly formatting files |
| 62 | |
| 63 | ## [v0.3.0] - 2022-02-22 |
| 64 | |
| 65 | This is gofumpt's third major release, based on Go 1.18's gofmt. |
| 66 | The jump from Go 1.17's gofmt should bring a noticeable speed-up, |
| 67 | as the tool can now format many files concurrently. |
| 68 | On an 8-core laptop, formatting a large codebase is 4x as fast. |
| 69 | |
| 70 | The following [formatting rules](https://github.com/mvdan/gofumpt#Added-rules) are added: |
| 71 | |
| 72 | * Functions should separate `) {` where the indentation helps readability |
| 73 | * Field lists should not have leading or trailing empty lines |
| 74 | |
| 75 | The following changes are included as well: |
| 76 | |
| 77 | * Generated files are now fully formatted when given as explicit arguments |
| 78 | * Prepare for Go 1.18's module workspaces, which could cause errors |
| 79 | * Import paths sharing a prefix with the current module path are no longer |
| 80 | grouped with standard library imports |
| 81 | * `format.Options` gains a `ModulePath` field per the last bullet point |
| 82 | |
| 83 | ## [v0.2.1] - 2021-12-12 |
| 84 | |
| 85 | This bugfix release resolves a number of issues: |
| 86 | |
| 87 | * Add deprecated flags `-s` and `-r` once again, now giving useful errors |
| 88 | * Avoid a panic with certain function declaration styles |
| 89 | * Don't group interface members of different kinds |
| 90 | * Account for leading comments in composite literals |
| 91 | |
| 92 | ## [v0.2.0] - 2021-11-10 |
| 93 | |
| 94 | This is gofumpt's second major release, based on Go 1.17's gofmt. |
| 95 | The jump from Go 1.15's gofmt should bring a mild speed-up, |
| 96 | as walking directories with `filepath.WalkDir` uses fewer syscalls. |
| 97 | |
| 98 | gofumports is now removed, after being deprecated in [v0.1.0]. |
| 99 | Its main purpose was IDE integration; it is now recommended to use gopls, |
| 100 | which in turn implements goimports and supports gofumpt natively. |
| 101 | IDEs which don't integrate with gopls (such as GoLand) implement goimports too, |
| 102 | so it is safe to use gofumpt as their "format on save" command. |
| 103 | See the [installation instructions](https://github.com/mvdan/gofumpt#Installation) |
| 104 | for more details. |
| 105 | |
| 106 | The following [formatting rules](https://github.com/mvdan/gofumpt#Added-rules) are added: |
| 107 | |
| 108 | * Composite literals should not have leading or trailing empty lines |
| 109 | * No empty lines following an assignment operator |
| 110 | * Functions using an empty line for readability should use a `) {` line instead |
| 111 | * Remove unnecessary empty lines from interfaces |
| 112 | |
| 113 | Finally, the following changes are made to the gofumpt tool: |
| 114 | |
| 115 | * Initial support for Go 1.18's type parameters is added |
| 116 | * The `-r` flag is removed in favor of `gofmt -r` |
| 117 | * The `-s` flag is removed as it is always enabled |
| 118 | * Vendor directories are skipped unless given as explicit arguments |
| 119 | * The added rules are not applied to generated Go files |
| 120 | * The `format` Go API now also applies the `gofmt -s` simplification |
| 121 | * Add support for `//gofumpt:diagnose` comments |
| 122 | |
| 123 | ## [v0.1.1] - 2021-03-11 |
| 124 | |
| 125 | This bugfix release backports fixes for a few issues: |
| 126 | |
| 127 | * Keep leading empty lines in func bodies if they help readability |
| 128 | * Avoid breaking comment alignment on empty field lists |
| 129 | * Add support for `//go-sumtype:` directives |
| 130 | |
| 131 | ## [v0.1.0] - 2021-01-05 |
| 132 | |
| 133 | This is gofumpt's first release, based on Go 1.15.x. It solidifies the features |
| 134 | which have worked well for over a year. |
| 135 | |
| 136 | This release will be the last to include `gofumports`, the fork of `goimports` |
| 137 | which applies `gofumpt`'s rules on top of updating the Go import lines. Users |
| 138 | who were relying on `goimports` in their editors or IDEs to apply both `gofumpt` |
| 139 | and `goimports` in a single step should switch to gopls, the official Go |
| 140 | language server. It is supported by many popular editors such as VS Code and |
| 141 | Vim, and already bundles gofumpt support. Instructions are available [in the |
| 142 | README](https://github.com/mvdan/gofumpt). |
| 143 | |
| 144 | `gofumports` also added maintenance work and potential confusion to end users. |
| 145 | In the future, there will only be one way to use `gofumpt` from the command |
| 146 | line. We also have a [Go API](https://pkg.go.dev/mvdan.cc/gofumpt/format) for |
| 147 | those building programs with gofumpt. |
| 148 | |
| 149 | Finally, this release adds the `-version` flag, to print the tool's own version. |
| 150 | The flag will work for "master" builds too. |
| 151 | |
| 152 | [v0.6.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.6.0 |
| 153 | [#271]: https://github.com/mvdan/gofumpt/issues/271 |
| 154 | [#280]: https://github.com/mvdan/gofumpt/issues/280 |
| 155 | [#288]: https://github.com/mvdan/gofumpt/issues/288 |
| 156 | |
| 157 | [v0.5.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.5.0 |
| 158 | [#235]: https://github.com/mvdan/gofumpt/issues/235 |
| 159 | [#253]: https://github.com/mvdan/gofumpt/issues/253 |
| 160 | [#256]: https://github.com/mvdan/gofumpt/issues/256 |
| 161 | [#260]: https://github.com/mvdan/gofumpt/issues/260 |
| 162 | |
| 163 | [v0.4.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.4.0 |
| 164 | [#212]: https://github.com/mvdan/gofumpt/issues/212 |
| 165 | [#217]: https://github.com/mvdan/gofumpt/issues/217 |
| 166 | |
| 167 | [v0.3.1]: https://github.com/mvdan/gofumpt/releases/tag/v0.3.1 |
| 168 | [#208]: https://github.com/mvdan/gofumpt/issues/208 |
| 169 | [#211]: https://github.com/mvdan/gofumpt/pull/211 |
| 170 | |
| 171 | [v0.3.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.3.0 |
| 172 | [v0.2.1]: https://github.com/mvdan/gofumpt/releases/tag/v0.2.1 |
| 173 | [v0.2.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.2.0 |
| 174 | [v0.1.1]: https://github.com/mvdan/gofumpt/releases/tag/v0.1.1 |
| 175 | [v0.1.0]: https://github.com/mvdan/gofumpt/releases/tag/v0.1.0 |