mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 21:07:45 +08:00
fix(merkle) use defer
This commit is contained in:
parent
e720a6a11c
commit
9420200a4e
@ -307,6 +307,8 @@ func FindLink(n *Node, k u.Key, found []*Node) (int, error) {
|
||||
func (ds *dagService) GetDAG(ctx context.Context, root *Node) <-chan *Node {
|
||||
sig := make(chan *Node)
|
||||
go func() {
|
||||
defer close(sig)
|
||||
|
||||
var keys []u.Key
|
||||
for _, lnk := range root.Links {
|
||||
keys = append(keys, u.Key(lnk.Hash))
|
||||
@ -350,7 +352,6 @@ func (ds *dagService) GetDAG(ctx context.Context, root *Node) <-chan *Node {
|
||||
// TODO: bubble errors back up.
|
||||
log.Errorf("Did not receive correct number of nodes!")
|
||||
}
|
||||
close(sig)
|
||||
}()
|
||||
|
||||
return sig
|
||||
|
||||
Loading…
Reference in New Issue
Block a user