Skip to content

Commit eed6cff

Browse files
build(deps): bump mvdan.cc/gofumpt from 0.9.2 to 0.11.0 (#6687)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent c7e3d32 commit eed6cff

9 files changed

Lines changed: 69 additions & 9 deletions

File tree

.golangci.next.reference.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4756,6 +4756,19 @@ formatters:
47564756
# Default: ""
47574757
module-path: github.com/org/project
47584758

4759+
# Extra formatting rules.
4760+
extra:
4761+
# Groups function parameters with repeated types.
4762+
# Default: false
4763+
group-params: true
4764+
# Clothes naked returns in functions with named results.
4765+
# Default: false
4766+
clothe-returns: true
4767+
# Multi-line function calls with the opening parenthesis at the end of a line should place the closing parenthesis at the start of a line.
4768+
# Default: false
4769+
balance-calls: true
4770+
4771+
# Deprecated: use `extra` instead.
47594772
# Choose whether to use the extra rules.
47604773
# Default: false
47614774
extra-rules: true

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ linters:
239239
text: "SA1019: config.ExhaustructSettings is deprecated: use ExhaustructV5Settings instead."
240240
linters:
241241
- staticcheck
242+
- path: pkg/goformatters/gofumpt/gofumpt.go
243+
text: "SA1019: settings.ExtraRules is deprecated: use Extra instead."
244+
linters:
245+
- staticcheck
242246
- path: pkg/golinters/gomodguard/
243247
linters:
244248
- dupl

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ require (
157157
golang.org/x/sys v0.47.0
158158
golang.org/x/tools v0.48.0
159159
honnef.co/go/tools v0.7.0
160-
mvdan.cc/gofumpt v0.9.2
160+
mvdan.cc/gofumpt v0.11.0
161161
mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15
162162
)
163163

go.sum

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,24 @@
22402240
"module-path": {
22412241
"description": " Module path which contains the source code being formatted.",
22422242
"type": "string"
2243+
},
2244+
"extra": {
2245+
"type": "object",
2246+
"additionalProperties": false,
2247+
"properties": {
2248+
"group-params": {
2249+
"type": "boolean",
2250+
"default": false
2251+
},
2252+
"clothe-returns": {
2253+
"type": "boolean",
2254+
"default": false
2255+
},
2256+
"balance-calls": {
2257+
"type": "boolean",
2258+
"default": false
2259+
}
2260+
}
22432261
}
22442262
}
22452263
},

pkg/config/formatters_settings.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ type GoFmtRewriteRule struct {
4242
}
4343

4444
type GoFumptSettings struct {
45-
ModulePath string `mapstructure:"module-path"`
46-
ExtraRules bool `mapstructure:"extra-rules"`
45+
ModulePath string `mapstructure:"module-path"`
46+
Extra GoFumptExtra `mapstructure:"extra"`
47+
48+
// Deprecated: use Extra instead.
49+
ExtraRules bool `mapstructure:"extra-rules"`
4750

4851
LangVersion string `mapstructure:"-"`
4952
}
5053

54+
type GoFumptExtra struct {
55+
GroupParams bool `mapstructure:"group-params"`
56+
ClotheReturns bool `mapstructure:"clothe-returns"`
57+
BalanceCalls bool `mapstructure:"balance-calls"`
58+
}
59+
5160
type GoImportsSettings struct {
5261
LocalPrefixes []string `mapstructure:"local-prefixes"`
5362
}

pkg/goformatters/gofumpt/gofumpt.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
gofumpt "mvdan.cc/gofumpt/format"
77

88
"github.com/golangci/golangci-lint/v2/pkg/config"
9+
"github.com/golangci/golangci-lint/v2/pkg/goformatters/internal"
910
)
1011

1112
const Name = "gofumpt"
@@ -18,10 +19,19 @@ func New(settings *config.GoFumptSettings, goVersion string) *Formatter {
1819
var options gofumpt.Options
1920

2021
if settings != nil {
22+
if settings.ExtraRules {
23+
internal.FormatterLogger.Warnf("gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.")
24+
}
25+
2126
options = gofumpt.Options{
2227
LangVersion: getLangVersion(goVersion),
2328
ModulePath: settings.ModulePath,
2429
ExtraRules: settings.ExtraRules,
30+
Extra: gofumpt.Extra{
31+
GroupParams: settings.Extra.GroupParams,
32+
ClotheReturns: settings.Extra.ClotheReturns,
33+
BalanceCalls: settings.Extra.BalanceCalls,
34+
},
2535
}
2636
}
2737

pkg/golinters/gofumpt/testdata/gofumpt_with_extra.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ package testdata
33

44
import "fmt"
55

6-
func GofmtNotExtra(bar string, baz string) { // want "File is not properly formatted"
6+
func GroupedType(bar string, baz string) { // want "File is not properly formatted"
77
fmt.Print("foo")
88
}
9+
10+
func RakedReturns() (err error) {
11+
return
12+
}

pkg/golinters/gofumpt/testdata/gofumpt_with_extra.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ formatters:
55
- gofumpt
66
settings:
77
gofumpt:
8-
extra-rules: true
8+
extra:
9+
group-params: true
10+
clothe-returns: true

0 commit comments

Comments
 (0)