Skip to content

Commit

Permalink
expand lint rule to avoid dealing with context.WithCancel cases
Browse files Browse the repository at this point in the history
  • Loading branch information
hasson82 committed Jun 19, 2024
1 parent 58ff83f commit 7da7920
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ 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()'
# - Make sure all context usages are done timeout.
git grep -e 'context.Background()' --or -e 'context.TODO()' -- "*_test.go" | not grep -v 'context.WithTimeout(context.Background()' | not grep -v 'context.WithCancel(context.Background' | not grep -v 'context.WithTimeOut(context.TODO()'

# - 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.
Expand Down

0 comments on commit 7da7920

Please sign in to comment.