diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 18c34aafd0d3..2ee3375df8b3 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1340,6 +1340,10 @@ linters-settings: # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it. # Default: false ignore-missing: true + # Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are + # still required to have `t.Parallel`, but subtests are allowed to skip it. + # Default: false + ignore-missing-subtests: true prealloc: # IMPORTANT: we don't recommend using this linter before doing performance profiling. diff --git a/go.mod b/go.mod index 530f4c0c159c..5f93b18351c5 100644 --- a/go.mod +++ b/go.mod @@ -58,7 +58,7 @@ require ( github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 github.com/kulti/thelper v0.6.3 - github.com/kunwardeep/paralleltest v1.0.7 + github.com/kunwardeep/paralleltest v1.0.8 github.com/kyoh86/exportloopref v0.1.11 github.com/ldez/gomoddirectives v0.2.3 github.com/ldez/tagliatelle v0.5.0 @@ -117,7 +117,7 @@ require ( gitlab.com/bosi/decorder v0.4.0 go.tmz.dev/musttag v0.7.1 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.11.0 + golang.org/x/tools v0.11.1 gopkg.in/yaml.v3 v3.0.1 honnef.co/go/tools v0.4.3 mvdan.cc/gofumpt v0.5.0 diff --git a/go.sum b/go.sum index 9251a1d8f7a0..1facde477af8 100644 --- a/go.sum +++ b/go.sum @@ -335,6 +335,8 @@ 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.7 h1:2uCk94js0+nVNQoHZNLBkAR1DQJrVzw6T0RMzJn55dQ= github.com/kunwardeep/paralleltest v1.0.7/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= +github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= +github.com/kunwardeep/paralleltest v1.0.8/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= @@ -879,6 +881,8 @@ golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc= +golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index a1778ed99eb8..0fc503254d40 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -655,7 +655,8 @@ type NoNamedReturnsSettings struct { ReportErrorInDefer bool `mapstructure:"report-error-in-defer"` } type ParallelTestSettings struct { - IgnoreMissing bool `mapstructure:"ignore-missing"` + IgnoreMissing bool `mapstructure:"ignore-missing"` + IgnoreMissingSubtests bool `mapstructure:"ignore-missing-subtests"` } type PreallocSettings struct { diff --git a/pkg/golinters/paralleltest.go b/pkg/golinters/paralleltest.go index 92201e4e2fc0..4c03952c10a2 100644 --- a/pkg/golinters/paralleltest.go +++ b/pkg/golinters/paralleltest.go @@ -9,13 +9,14 @@ import ( ) func NewParallelTest(settings *config.ParallelTestSettings) *goanalysis.Linter { - a := paralleltest.Analyzer + a := paralleltest.NewAnalyzer() var cfg map[string]map[string]any if settings != nil { cfg = map[string]map[string]any{ a.Name: { - "i": settings.IgnoreMissing, + "i": settings.IgnoreMissing, + "ignoremissingsubtests": settings.IgnoreMissingSubtests, }, } }