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

Tree @d3c1c83 (Download .tar.gz)

options_go1.7.go @d3c1c83raw · 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()
	}
}