code: func WaitFunc(interval, timeout time.Duration, f func() bool) bool {
  	after := time.After(timeout)
  	for {
  		select {
  		case <-time.After(interval):
  			if f() {
  				return true
  			}
  		case <-after:
  			return false
  		}
  	}
  
  	return false
  }
docs: // WaitFunc waits until specified function returns true.