Skip to content

Commit 9a5b75d

Browse files
committed
bump github.com/kulti/thelper from 0.5.1 to 0.6.2
1 parent 13c4726 commit 9a5b75d

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
4747
github.com/julz/importas v0.1.0
4848
github.com/kisielk/errcheck v1.6.0
49-
github.com/kulti/thelper v0.5.1
49+
github.com/kulti/thelper v0.6.2
5050
github.com/kunwardeep/paralleltest v1.0.3
5151
github.com/kyoh86/exportloopref v0.1.8
5252
github.com/ldez/gomoddirectives v0.2.2

go.sum

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

+5
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ type ThelperSettings struct {
549549
Name bool `mapstructure:"name"`
550550
Begin bool `mapstructure:"begin"`
551551
} `mapstructure:"test"`
552+
Fuzz struct {
553+
First bool `mapstructure:"first"`
554+
Name bool `mapstructure:"name"`
555+
Begin bool `mapstructure:"begin"`
556+
} `mapstructure:"fuzz"`
552557
Benchmark struct {
553558
First bool `mapstructure:"first"`
554559
Name bool `mapstructure:"name"`

pkg/golinters/thelper.go

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ func NewThelper(cfg *config.ThelperSettings) *goanalysis.Linter {
2727
opts = append(opts, "t_first")
2828
}
2929

30+
if cfg.Fuzz.Name {
31+
opts = append(opts, "f_name")
32+
}
33+
if cfg.Fuzz.Begin {
34+
opts = append(opts, "f_begin")
35+
}
36+
if cfg.Fuzz.First {
37+
opts = append(opts, "f_first")
38+
}
39+
3040
if cfg.Benchmark.Name {
3141
opts = append(opts, "b_name")
3242
}

test/testdata/thelper_go118.go

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build go1.18
2+
// +build go1.18
3+
4+
//args: -Ethelper
5+
package testdata
6+
7+
import "testing"
8+
9+
func fhelperWithHelperAfterAssignment(f *testing.F) { // ERROR "test helper function should start from f.Helper()"
10+
_ = 0
11+
f.Helper()
12+
}
13+
14+
func fhelperWithNotFirst(s string, f *testing.F, i int) { // ERROR `parameter \*testing.F should be the first`
15+
f.Helper()
16+
}
17+
18+
func fhelperWithIncorrectName(o *testing.F) { // ERROR `parameter \*testing.F should have name f`
19+
o.Helper()
20+
}
21+
22+
func FuzzSubtestShouldNotBeChecked(f *testing.F) {
23+
f.Add(5, "hello")
24+
f.Fuzz(func(t *testing.T, a int, b string) {})
25+
}

0 commit comments

Comments
 (0)