File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ func doNotCallTFailNowInsideGoroutine(m dsl.Matcher) {
59
59
Where (m ["require" ].Text == "require" ).
60
60
Report ("Do not call functions that may call t.FailNow in a goroutine, as this can cause data races (see testing.go:834)" )
61
61
62
+ // require.Eventually runs the function in a goroutine.
63
+ m .Match (`
64
+ require.Eventually(t, func() bool {
65
+ $*_
66
+ $require.$_($*_)
67
+ $*_
68
+ }, $*_)` ).
69
+ At (m ["require" ]).
70
+ Where (m ["require" ].Text == "require" ).
71
+ Report ("Do not call functions that may call t.FailNow in a goroutine, as this can cause data races (see testing.go:834)" )
72
+
62
73
m .Match (`
63
74
go func($*_){
64
75
$*_
@@ -90,10 +101,10 @@ func InTx(m dsl.Matcher) {
90
101
At (m ["f" ]).
91
102
Report ("Do not use the database directly within the InTx closure. Use '$y' instead of '$x'." )
92
103
93
- //When using a tx closure, ensure that if you pass the db to another
94
- //function inside the closure, it is the tx.
95
- //This will miss more complex cases such as passing the db as apart
96
- //of another struct.
104
+ // When using a tx closure, ensure that if you pass the db to another
105
+ // function inside the closure, it is the tx.
106
+ // This will miss more complex cases such as passing the db as apart
107
+ // of another struct.
97
108
m .Match (`
98
109
$x.InTx(func($y database.Store) error {
99
110
$*_
You can’t perform that action at this time.
0 commit comments