Codebase list golang-github-vbauerster-mpb / b53c5f0 options_go1.7.go
b53c5f0

Tree @b53c5f0 (Download .tar.gz)

options_go1.7.go @b53c5f0raw · history · blame

//+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()
	}
}