Skip to content

Commit

Permalink
add context with timeout check to vet script
Browse files Browse the repository at this point in the history
  • Loading branch information
hasson82 committed Jun 19, 2024
1 parent c04b085 commit 58ff83f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ not grep 'func Test[^(]' -- test/*.go
git grep 'func (s) ' -- "*_test.go" | not grep -v 'func (s) Test'
git grep 'func [A-Z]' -- "*_test.go" | not grep -v 'func Test\|Benchmark\|Example'

# - Make sure not context usage are done without timeout.
git grep 'context.Background()' -- "*_test.go" | not grep -v 'context.WithTimeout(context.Background()'

# - Do not use time.After except in tests. It has the potential to leak the
# timer since there is no way to stop it early.
git grep -l 'time.After(' -- "*.go" | not grep -v '_test.go\|test_utils\|testutils'
Expand Down

0 comments on commit 58ff83f

Please sign in to comment.