Skip to content

Commit 58ff83f

Browse files
committed
add context with timeout check to vet script
1 parent c04b085 commit 58ff83f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/vet.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ not grep 'func Test[^(]' -- test/*.go
5050
git grep 'func (s) ' -- "*_test.go" | not grep -v 'func (s) Test'
5151
git grep 'func [A-Z]' -- "*_test.go" | not grep -v 'func Test\|Benchmark\|Example'
5252

53+
# - Make sure not context usage are done without timeout.
54+
git grep 'context.Background()' -- "*_test.go" | not grep -v 'context.WithTimeout(context.Background()'
55+
5356
# - Do not use time.After except in tests. It has the potential to leak the
5457
# timer since there is no way to stop it early.
5558
git grep -l 'time.After(' -- "*.go" | not grep -v '_test.go\|test_utils\|testutils'

0 commit comments

Comments
 (0)