Skip to content

Commit 290bd0d

Browse files
authored
add semgrep rule to check for potential time.After leaks (#12001)
1 parent 99e7735 commit 290bd0d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.semgrep/time_after.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
rules:
2+
- id: "time-after-leak"
3+
patterns:
4+
- pattern: |
5+
select {
6+
case <- time.After(...): ...
7+
}
8+
message: "Potential leak of time.Timer, consider using NewSafeTimer instead"
9+
languages:
10+
- "go"
11+
severity: "WARNING"
12+
paths:
13+
exclude:
14+
- "testutil/*"
15+
- "*testing.go"
16+
- "*_test.go"

0 commit comments

Comments
 (0)