Skip to content

AlexeySoshin/go2future

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go2Future

Deferred value implementation in Go2

Provides a higher-level concurrency construct, that eliminates the need for go statement and channels in most common use-cases.

Usage

Creating a new Future:

f1 := NewFuture(func() (string, error) {
    time.Sleep(1000)
    return "F1", nil
})

Waiting for its result:

result := f1.Get()

Discarding the Future in case it's not needed:

f3 := NewFuture(func() (string, error) {
    time.Sleep(100)
    fmt.Println("I'm done!")
    return "F3", nil
})
f3.Cancel()

Installation

./install.sh

This will set your Go to development version that supports generics and provides you with go2go tool

License

MIT

About

Deferred value implementation in Go2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages