8000 GitHub - euskadi31/go-future: go-future is an implementation of future in Go.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

euskadi31/go-future

Repository files navigation

Go Future Last release Documentation

Go Report Card

Branch Status Coverage
master Go Coveralls

go-future is an implementation of future in Go.

Example

package main

import (
    "fmt"

    "github.com/euskadi31/go-future"
)

func asyncFunc() *future.Future {
    f := future.New()

    go func(f *future.Future) {
        f.Value("my async value")
    }(f)

    return f
}

func main() {
    f := asyncFunc();

    v, err := f.Get()
    if err != nil {
        panic(err)
    }

    fmt.Println(v)

}

With Fill

package main

import (
    "fmt"

    "github.com/euskadi31/go-future"
)

func asyncFunc() *future.Future {
    f := future.New()

    go func(f *future.Future) {
        f.Value("my async value")
    }(f)

    return f
}

func main() {
    f := asyncFunc();

    var v string
    if err := f.Fill(&v); err != nil {
        panic(err)
    }

    fmt.Println(v)
}

License

go-future is licensed under the MIT license.

About

go-future is an implementation of future in Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0