ctx must not be nil
Vladimir Bauer
8 years ago
| 6 | 6 |
// WithContext provided context will be used for cancellation purposes
|
| 7 | 7 |
func WithContext(ctx context.Context) ProgressOption {
|
| 8 | 8 |
return func(s *pState) {
|
| 9 | |
if ctx != nil {
|
| 10 | |
s.cancel = ctx.Done()
|
|
9 |
if ctx == nil {
|
|
10 |
panic("ctx must not be nil")
|
| 11 | 11 |
}
|
|
12 |
s.cancel = ctx.Done()
|
| 12 | 13 |
}
|
| 13 | 14 |
}
|