Skip to content

Commit 78dedd3

Browse files
xobotyildez
andauthored
build(deps): bump github.com/GaijinEntertainment/go-exhaustruct from v3.3.1 to 4.0.0 (#5984)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent fca8610 commit 78dedd3

File tree

6 files changed

+80
-30
lines changed

6 files changed

+80
-30
lines changed

.golangci.next.reference.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,42 @@ linters:
502502
default-case-required: true
503503

504504
exhaustruct:
505-
# List of regular expressions to match struct packages and their names.
506-
# Regular expressions must match complete canonical struct package/name/structname.
507-
# If this list is empty, all structs are tested.
505+
# List of regular expressions to match type names that should be processed.
506+
# Anonymous structs can be matched by '<anonymous>' alias.
507+
#
508+
# Each regular expression must match the full type name, including package path.
509+
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
510+
# but not `http\.Cookie`.
508511
# Default: []
509512
include:
510513
- '.+\.Test'
511514
- 'example\.com/package\.ExampleStruct[\d]{1,2}'
512-
# List of regular expressions to exclude struct packages and their names from checks.
513-
# Regular expressions must match complete canonical struct package/name/structname.
515+
# List of regular expressions to match type names that should be excluded from processing.
516+
# Anonymous structs can be matched by '<anonymous>' alias.
517+
# Has precedence over `include`.
518+
# Each regular expression must match the full type name, including package path.
519+
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
520+
# but not `http\.Cookie`.
514521
# Default: []
515522
exclude:
516523
- '.+/cobra\.Command$'
524+
# Allows empty structures, effectively excluding them from the check.
525+
# Default: false
526+
allow-empty: true
527+
# List of regular expressions to match type names that should be allowed to be empty.
528+
# Anonymous structs can be matched by '<anonymous>' alias.
529+
# Each regular expression must match the full type name, including package path.
530+
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
531+
# but not `http\.Cookie`.
532+
# Default: []
533+
allow-empty-rx:
534+
- '.*/http\.Cookie'
535+
# Allows empty structures in return statements.
536+
# Default: false
537+
allow-empty-returns: true
538+
# Allows empty structures in variable declarations.
539+
# Default: false
540+
allow-empty-declarations: true
517541

518542
fatcontext:
519543
# Check for potential fat contexts in struct pointers.

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.24.0
55
require (
66
4d63.com/gocheckcompilerdirectives v1.3.0
77
4d63.com/gochecknoglobals v0.2.2
8+
dev.gaijin.team/go/exhaustruct/v4 v4.0.0
89
github.com/4meepo/tagalign v1.4.3
910
github.com/Abirdcfly/dupword v0.1.6
1011
github.com/AlwxSin/noinlineerr v1.0.5
@@ -13,7 +14,6 @@ require (
1314
github.com/Antonboom/testifylint v1.6.1
1415
github.com/BurntSushi/toml v1.5.0
1516
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
16-
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1
1717
github.com/OpenPeeDeeP/depguard/v2 v2.2.1
1818
github.com/alecthomas/chroma/v2 v2.20.0
1919
github.com/alecthomas/go-check-sumtype v0.3.1
@@ -145,6 +145,7 @@ require (
145145

146146
require (
147147
codeberg.org/chavacava/garif v0.2.0 // indirect
148+
dev.gaijin.team/go/golib v0.6.0 // indirect
148149
github.com/Masterminds/semver/v3 v3.3.1 // indirect
149150
github.com/alfatraining/structtag v1.0.0 // indirect
150151
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
@@ -210,9 +211,8 @@ require (
210211
github.com/valyala/bytebufferpool v1.0.0 // indirect
211212
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
212213
github.com/yusufpapurcu/wmi v1.2.4 // indirect
213-
go.uber.org/atomic v1.7.0 // indirect
214-
go.uber.org/multierr v1.6.0 // indirect
215-
go.uber.org/zap v1.24.0 // indirect
214+
go.uber.org/multierr v1.10.0 // indirect
215+
go.uber.org/zap v1.27.0 // indirect
216216
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
217217
golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b // indirect
218218
golang.org/x/text v0.27.0 // indirect

go.sum

Lines changed: 10 additions & 13 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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,28 @@
13051305
"items": {
13061306
"type": "string"
13071307
}
1308+
},
1309+
"allow-empty": {
1310+
"description": "Allows empty structures, effectively excluding them from the check.",
1311+
"type": "boolean",
1312+
"default": false
1313+
},
1314+
"allow-empty-rx": {
1315+
"description": "List of regular expressions to match type names that should be allowed to be empty.",
1316+
"type": "array",
1317+
"items": {
1318+
"type": "string"
1319+
}
1320+
},
1321+
"allow-empty-returns": {
1322+
"description": "Allows empty structures in return statements.",
1323+
"type": "boolean",
1324+
"default": false
1325+
},
1326+
"allow-empty-declarations": {
1327+
"description": "Allows empty structures in variable declarations.",
1328+
"type": "boolean",
1329+
"default": false
13081330
}
13091331
}
13101332
},

pkg/config/linters_settings.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,12 @@ type ExhaustiveSettings struct {
421421
}
422422

423423
type ExhaustructSettings struct {
424-
Include []string `mapstructure:"include"`
425-
Exclude []string `mapstructure:"exclude"`
424+
Include []string `mapstructure:"include"`
425+
Exclude []string `mapstructure:"exclude"`
426+
AllowEmpty bool `mapstructure:"allow-empty"`
427+
AllowEmptyRx []string `mapstructure:"allow-empty-rx"`
428+
AllowEmptyReturns bool `mapstructure:"allow-empty-returns"`
429+
AllowEmptyDeclarations bool `mapstructure:"allow-empty-declarations"`
426430
}
427431

428432
type FatcontextSettings struct {

pkg/golinters/exhaustruct/exhaustruct.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
package exhaustruct
22

33
import (
4-
exhaustruct "github.com/GaijinEntertainment/go-exhaustruct/v3/analyzer"
4+
exhaustruct "dev.gaijin.team/go/exhaustruct/v4/analyzer"
55

66
"github.com/golangci/golangci-lint/v2/pkg/config"
77
"github.com/golangci/golangci-lint/v2/pkg/goanalysis"
88
"github.com/golangci/golangci-lint/v2/pkg/golinters/internal"
99
)
1010

1111
func New(settings *config.ExhaustructSettings) *goanalysis.Linter {
12-
var include, exclude []string
13-
12+
cfg := exhaustruct.Config{}
1413
if settings != nil {
15-
include = settings.Include
16-
exclude = settings.Exclude
14+
cfg.IncludeRx = settings.Include
15+
cfg.ExcludeRx = settings.Exclude
16+
cfg.AllowEmpty = settings.AllowEmpty
17+
cfg.AllowEmptyRx = settings.AllowEmptyRx
18+
cfg.AllowEmptyReturns = settings.AllowEmptyReturns
19+
cfg.AllowEmptyDeclarations = settings.AllowEmptyDeclarations
1720
}
1821

19-
analyzer, err := exhaustruct.NewAnalyzer(include, exclude)
22+
analyzer, err := exhaustruct.NewAnalyzer(cfg)
2023
if err != nil {
2124
internal.LinterLogger.Fatalf("exhaustruct configuration: %v", err)
2225
}

0 commit comments

Comments
 (0)