|
|
|
|
|
by hornetblack
4793 days ago
|
|
You could save the future in the Future implementation type future struct {
completed bool
result interface{}
ch <-chan interface{}
}
Edit: Or just check if the channel is closed func (f *future) Wait() interface{} {
v, ok := <- ch
if ok { f.result = v; return v }
else { return f.result }
}
|
|