github.com/slava-ustovytski/docker@v1.8.2-rc1/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  }