diff --git a/go.mod b/go.mod index 1de62e5fc4bb..ec6f3ecc7268 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/kisielk/errcheck v1.7.0 github.com/kkHAIKE/contextcheck v1.1.4 github.com/kulti/thelper v0.6.3 - github.com/kunwardeep/paralleltest v1.0.9 + github.com/kunwardeep/paralleltest v1.0.10 github.com/kyoh86/exportloopref v0.1.11 github.com/ldez/gomoddirectives v0.2.3 github.com/ldez/tagliatelle v0.5.0 diff --git a/go.sum b/go.sum index e7c09483624b..3bae41afefe6 100644 --- a/go.sum +++ b/go.sum @@ -344,8 +344,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.9 h1:3Sr2IfFNcsMmlqPk1cjTUbJ4zofKPGyHxenwPebgTug= -github.com/kunwardeep/paralleltest v1.0.9/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= +github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= +github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index c8cae4459530..5e18f6acb60d 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -703,8 +703,9 @@ type NoNamedReturnsSettings struct { } type ParallelTestSettings struct { - IgnoreMissing bool `mapstructure:"ignore-missing"` - IgnoreMissingSubtests bool `mapstructure:"ignore-missing-subtests"` + Go string `mapstructure:"-"` + IgnoreMissing bool `mapstructure:"ignore-missing"` + IgnoreMissingSubtests bool `mapstructure:"ignore-missing-subtests"` } type PerfSprintSettings struct { diff --git a/pkg/golinters/paralleltest.go b/pkg/golinters/paralleltest.go index c49f74aa2fad..5a99830b5636 100644 --- a/pkg/golinters/paralleltest.go +++ b/pkg/golinters/paralleltest.go @@ -13,12 +13,16 @@ func NewParallelTest(settings *config.ParallelTestSettings) *goanalysis.Linter { var cfg map[string]map[string]any if settings != nil { - cfg = map[string]map[string]any{ - a.Name: { - "i": settings.IgnoreMissing, - "ignoremissingsubtests": settings.IgnoreMissingSubtests, - }, + d := map[string]any{ + "i": settings.IgnoreMissing, + "ignoremissingsubtests": settings.IgnoreMissingSubtests, } + + if config.IsGreaterThanOrEqualGo122(settings.Go) { + d["ignoreloopVar"] = true + } + + cfg = map[string]map[string]any{a.Name: d} } return goanalysis.NewLinter( diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 46973acd8c70..977ef0d1c61d 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -238,6 +238,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { govetCfg.Go = m.cfg.Run.Go + parallelTestCfg.Go = m.cfg.Run.Go + gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go) if gofumptCfg.LangVersion == "" {