Skip to content

build(deps): bump giithub.com/GaijinEntertainment/go-exhaustruct from v3.3.1 to 4.0.0 #5984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,18 +502,45 @@ linters:
default-case-required: true

exhaustruct:
# List of regular expressions to match struct packages and their names.
# Regular expressions must match complete canonical struct package/name/structname.
# If this list is empty, all structs are tested.
# List of regular expressions to match type names that should be
# processed. Anonymous structs can be matched by '<anonymous>' alias.
#
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
#
Comment on lines +505 to +511
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# List of regular expressions to match type names that should be
# processed. Anonymous structs can be matched by '<anonymous>' alias.
#
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
#
# List of regular expressions to match type names that should be processed.
# Anonymous structs can be matched by '<anonymous>' alias.
#
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
# but not `http\.Cookie`.

# Default: []
include:
- '.+\.Test'
- 'example\.com/package\.ExampleStruct[\d]{1,2}'
# List of regular expressions to exclude struct packages and their names from checks.
# Regular expressions must match complete canonical struct package/name/structname.
# List of regular expressions to match type names that should be
# excluded from processing. Anonymous structs can be matched by '<anonymous>'
# alias.
# Has precedence over IncludeRx.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
Comment on lines +516 to +522
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# List of regular expressions to match type names that should be
# excluded from processing. Anonymous structs can be matched by '<anonymous>'
# alias.
# Has precedence over IncludeRx.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
# List of regular expressions to match type names that should be
# excluded from processing.
# Anonymous structs can be matched by '<anonymous>' alias.
# Has precedence over `include`.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
# but not `http\.Cookie`.

# Default: []
exclude:
- '.+/cobra\.Command$'
# AllowEmpty allows empty structures, effectively excluding them from the check.
# Default: false
allow-empty: false
# List of regular expressions to match type names that should be
# allowed to be empty. Anonymous structs can be matched by '<anonymous>'
# alias.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
# Default: []
Comment on lines +529 to +535
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# List of regular expressions to match type names that should be
# allowed to be empty. Anonymous structs can be matched by '<anonymous>'
# alias.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be
# `.*/http\.Cookie`, but not `http\.Cookie`.
# Default: []
# List of regular expressions to match type names that should be allowed to be empty.
# Anonymous structs can be matched by '<anonymous>' alias.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
# but not `http\.Cookie`.
# Default: []

allow-empty-rx:
- '.*/http\.Cookie'
# Allows empty structures in return statements.
# Default: false
allow-empty-returns: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allow-empty-returns: false
allow-empty-returns: true

# Allows empty structures in variable declarations.
# Default: false
allow-empty-declarations: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allow-empty-declarations: false
allow-empty-declarations: true


fatcontext:
# Check for potential fat contexts in struct pointers.
Expand Down
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
module github.com/golangci/golangci-lint/v2

go 1.23.0
go 1.24

toolchain go1.24.6
Comment on lines +3 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
go 1.24
toolchain go1.24.6
go 1.23.0


require (
4d63.com/gocheckcompilerdirectives v1.3.0
4d63.com/gochecknoglobals v0.2.2
dev.gaijin.team/go/exhaustruct/v4 v4.0.0
github.com/4meepo/tagalign v1.4.3
github.com/Abirdcfly/dupword v0.1.6
github.com/AlwxSin/noinlineerr v1.0.5
Expand All @@ -13,7 +16,6 @@ require (
github.com/Antonboom/testifylint v1.6.1
github.com/BurntSushi/toml v1.5.0
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1
github.com/OpenPeeDeeP/depguard/v2 v2.2.1
github.com/alecthomas/chroma/v2 v2.20.0
github.com/alecthomas/go-check-sumtype v0.3.1
Expand Down Expand Up @@ -145,6 +147,7 @@ require (

require (
codeberg.org/chavacava/garif v0.2.0 // indirect
dev.gaijin.team/go/golib v0.6.0 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/alfatraining/structtag v1.0.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
Expand Down Expand Up @@ -210,9 +213,8 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/text v0.27.0 // indirect
Expand Down
23 changes: 10 additions & 13 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,12 @@ type ExhaustiveSettings struct {
}

type ExhaustructSettings struct {
Include []string `mapstructure:"include"`
Exclude []string `mapstructure:"exclude"`
Include []string `mapstructure:"include"`
Exclude []string `mapstructure:"exclude"`
AllowEmpty bool `mapstructure:"allow-empty"`
AllowEmptyRx []string `mapstructure:"allow-empty-rx"`
AllowEmptyReturns bool `mapstructure:"allow-empty-returns"`
AllowEmptyDeclarations bool `mapstructure:"allow-empty-declarations"`
}

type FatcontextSettings struct {
Expand Down
15 changes: 9 additions & 6 deletions pkg/golinters/exhaustruct/exhaustruct.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package exhaustruct

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

"github.com/golangci/golangci-lint/v2/pkg/config"
"github.com/golangci/golangci-lint/v2/pkg/goanalysis"
"github.com/golangci/golangci-lint/v2/pkg/golinters/internal"
)

func New(settings *config.ExhaustructSettings) *goanalysis.Linter {
var include, exclude []string

cfg := exhaustruct.Config{}
if settings != nil {
include = settings.Include
exclude = settings.Exclude
cfg.IncludeRx = settings.Include
cfg.ExcludeRx = settings.Exclude
cfg.AllowEmpty = settings.AllowEmpty
cfg.AllowEmptyRx = settings.AllowEmptyRx
cfg.AllowEmptyReturns = settings.AllowEmptyReturns
cfg.AllowEmptyDeclarations = settings.AllowEmptyDeclarations
}

analyzer, err := exhaustruct.NewAnalyzer(include, exclude)
analyzer, err := exhaustruct.NewAnalyzer(cfg)
if err != nil {
internal.LinterLogger.Fatalf("exhaustruct configuration: %v", err)
}
Expand Down
Loading