dgryski.semgrep-go.contextcancelable.cancelable-context-not-systematically-cancelled

Author
unknown
Download Count*
License
it is good practice to call context cancellation function, $X(), in any case
Run Locally
Run in CI
Defintion
rules:
- id: cancelable-context-not-systematically-cancelled
patterns:
- pattern: $_, $X := context.$CANCELABLE(...)
- pattern-not-inside: |
$_, $X := context.$CANCELABLE(...)
...
defer $X()
- pattern-not-inside: |
$_, $X := context.$CANCELABLE(...)
...
$X()
- metavariable-regex:
metavariable: $CANCELABLE
regex: (WithDeadline|WithTimeout)
message: it is good practice to call context cancellation function, $X(), in any
case
languages:
- go
severity: WARNING
metadata:
license: MIT
Short Link: https://sg.run/4lZ8