aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/options_go1.7.go
blob: ca9a5bad82f7b2ac2ffc2eb43ac772ef000dc979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//+build go1.7

package mpb

import "context"

// WithContext provided context will be used for cancellation purposes
func WithContext(ctx context.Context) ProgressOption {
	return func(s *pState) {
		if ctx == nil {
			panic("ctx must not be nil")
		}
		s.cancel = ctx.Done()
	}
}