mirror of
https://github.com/foomo/gofuncy.git
synced 2025-10-16 12:25:41 +00:00
wip: close chan
This commit is contained in:
parent
e268779e11
commit
3d9da4ba7a
11
go.go
11
go.go
@ -145,13 +145,13 @@ func Go(fn Func, opts ...Option) <-chan error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errChan := make(chan error)
|
errChan := make(chan error, 1)
|
||||||
go func(o *Options, errChan chan<- error) {
|
go func(o *Options, errChan chan<- error) {
|
||||||
var err error
|
var err error
|
||||||
defer func() {
|
defer func() {
|
||||||
o.l.Info("gofuncy --> closing chan")
|
o.l.Info("gofuncy --> closing chan")
|
||||||
close(errChan)
|
close(errChan)
|
||||||
o.l.Info("gofuncy --> closing chan done")
|
o.l.Info("gofuncy --> closing chan")
|
||||||
}()
|
}()
|
||||||
ctx := o.ctx
|
ctx := o.ctx
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
@ -187,11 +187,12 @@ func Go(fn Func, opts ...Option) <-chan error {
|
|||||||
}
|
}
|
||||||
ctx = injectParentRoutineIntoContext(ctx, RoutineFromContext(ctx))
|
ctx = injectParentRoutineIntoContext(ctx, RoutineFromContext(ctx))
|
||||||
ctx = injectRoutineIntoContext(ctx, o.name)
|
ctx = injectRoutineIntoContext(ctx, o.name)
|
||||||
o.l.Info("gofuncy --> calling")
|
l.Info("gofuncy --> calling")
|
||||||
err = fn(ctx)
|
err = fn(ctx)
|
||||||
o.l.Info("gofuncy --> done")
|
l.Info("gofuncy --> done")
|
||||||
defer o.l.Info("gofuncy --> out")
|
defer l.Info("gofuncy --> out")
|
||||||
errChan <- err
|
errChan <- err
|
||||||
|
l.Info("gofuncy <-- done")
|
||||||
}(o, errChan)
|
}(o, errChan)
|
||||||
|
|
||||||
o.l.Info("gofuncy --> returning")
|
o.l.Info("gofuncy --> returning")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user