summaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/options_go1.7.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/options_go1.7.go')
-rw-r--r--vendor/github.com/vbauerster/mpb/options_go1.7.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/vbauerster/mpb/options_go1.7.go b/vendor/github.com/vbauerster/mpb/options_go1.7.go
new file mode 100644
index 000000000..ca9a5bad8
--- /dev/null
+++ b/vendor/github.com/vbauerster/mpb/options_go1.7.go
@@ -0,0 +1,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()
+ }
+}