dgryski / semgrep-go

Go rules for semgrep and go-ruleguard
MIT License
457 stars 37 forks source link

How to handle false positives for leaky-time-after ? #60

Open zerkms opened 1 year ago

zerkms commented 1 year ago

Given this valid code:

func (ja *jsonAuth) timer() {
    for {
        select {
        case <-ja.ctx.Done():
            return
        case <-time.After(time.Minute):
            ja.tick()
        }
    }
}

where time.After is run every loop iteration but on application shutdown, how would one fix the rule violation?