code: func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
  	c := wait(done)
  	for {
  		_, open := <-c
  		ok, err := fn()
  		if err != nil {
  			return err
  		}
  		if ok {
  			return nil
  		}
  		if !open {
  			break
  		}
  	}
  	return ErrWaitTimeout
  }
docs: // WaitFor gets a channel from wait(), and then invokes fn once for every value
  // placed on the channel and once more when the channel is closed.  If fn
  // returns an error the loop ends and that error is returned, and if fn returns
  // true the loop ends and nil is returned. ErrWaitTimeout will be returned if
  // the channel is closed without fn ever returning true.