go-promise
go-promise copied to clipboard
all goroutines are asleep - deadlock
func PromisePipelining1() {
task1 := func() (r interface{}, err error) {
return 10, errors.New("error")
}
task2 := func(v interface{}) (r interface{}, err error) {
return v.(int) * 2, nil
}
f,ok := promise.Start(task1).Pipe(task2)
if ok {
r, err := f.Get() //return 20
fmt.Println(r,err)
}
}
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/fanliao/go-promise.(*Future).Get(0xc0420b8980, 0xc042083f38, 0x1, 0x1, 0xc0420b8980)
D:/Code/golang/src/github.com/fanliao/go-promise/future.go:138 +0x4f
main.PromisePipelining1()
D:/Code/golang/src/studygo/futrue/future.go:148 +0xd4
main.main()
D:/Code/golang/src/studygo/futrue/future.go:16 +0x27
exit status 2