github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/pkg/promise/promise.go (about)

     1  package promise
     2  
     3  // Go is a basic promise implementation: it wraps calls a function in a goroutine,
     4  // and returns a channel which will later return the function's return value.
     5  func Go(f func() error) chan error {
     6  	ch := make(chan error, 1)
     7  	go func() {
     8  		ch <- f()
     9  	}()
    10  	return ch
    11  }