From 58ff83f72e7cd5743d0677f7c2b43b06e324987d Mon Sep 17 00:00:00 2001 From: "user.name: \"Omer Hasson" Date: Wed, 19 Jun 2024 13:33:21 +0300 Subject: [PATCH] add context with timeout check to vet script --- scripts/vet.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/vet.sh b/scripts/vet.sh index f88529e7d146..7dac4c9ffdd5 100755 --- a/scripts/vet.sh +++ b/scripts/vet.sh @@ -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'