MCPcopy Create free account
hub / github.com/cloud-native-go/examples / Result

Method Result

ch04/future.go:39–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func (f *InnerFuture) Result() (string, error) {
40 f.once.Do(func() {
41 f.wg.Add(1)
42 defer f.wg.Done()
43 f.res = <-f.resCh
44 f.err = <-f.errCh
45 })
46
47 f.wg.Wait()
48
49 return f.res, f.err
50}
51
52func SlowFunction(ctx context.Context) Future {
53 resCh := make(chan string)

Callers

nothing calls this directly

Calls 1

WaitMethod · 0.65

Tested by

no test coverage detected