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

Tree @dc6347d (Download .tar.gz)

options_go1.7.go @dc6347draw · 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 {
			s.cancel = ctx.Done()
		}
	}
}