(ctx context.Context, d time.Duration)
| 214 | } |
| 215 | |
| 216 | func sleepWithContext(ctx context.Context, d time.Duration) error { |
| 217 | timer := time.NewTimer(d) |
| 218 | |
| 219 | defer func() { |
| 220 | _ = timer.Stop() |
| 221 | }() |
| 222 | |
| 223 | select { |
| 224 | case <-ctx.Done(): |
| 225 | return context.DeadlineExceeded |
| 226 | case <-timer.C: |
| 227 | return nil |
| 228 | } |
| 229 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…