Skip to content

Instantly share code, notes, and snippets.

@jonbodner
Last active August 24, 2017 17:02
Show Gist options
  • Save jonbodner/2109f5967df3527bcd1e61d008c9b0e5 to your computer and use it in GitHub Desktop.
Save jonbodner/2109f5967df3527bcd1e61d008c9b0e5 to your computer and use it in GitHub Desktop.
future-blog-post-8
func (f *futureImpl) GetUntil(d time.Duration) (interface{}, bool, error) {
select {
case <-f.done:
val, err := f.Get()
return val, false, err
case <-time.After(d):
return nil, true, nil
}
// This should never be executed
return nil, false, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment