shared/cancel/canceler.go
func (c *Canceler) Cancel() error {
	if !c.Cancelable() {
		return fmt.Errorf("This operation can't be canceled at this time")
	}

	c.lock.Lock()
	for req, ch := range c.reqChCancel {
		close(ch)
		delete(c.reqChCancel, req)
	}
	c.lock.Unlock()

	return nil
}
func (c *Canceler) Cancel() error {
	if !c.Cancelable() {
		return fmt.Errorf("This operation can't be canceled at this time")
	}

	c.lock.Lock()
	for req, ch := range c.reqChCancel {
		close(ch)
		delete(c.reqChCancel, req)
	}
	c.lock.Unlock()

	return nil
}
func ( c * Canceler ) Cancel ( ) error { if ! c . Cancelable ( ) { return fmt . Errorf ( " " ) } c . lock . Lock ( ) for req , ch := range c . reqChCancel { close ( ch ) delete ( c . reqChCancel , req ) } c . lock . Unlock ( ) return nil }
// Cancel will attempt to cancel all ongoing operations
Cancel will attempt to cancel all ongoing operations