mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 02:47:48 +08:00
refactor(commands): cleanup makeDagNodeLinkResults
License: MIT Signed-off-by: hannahhoward <hannah@hannahhoward.net>
This commit is contained in:
parent
b0dc73c45f
commit
f5ab6a3f5e
@ -212,20 +212,15 @@ The JSON output contains type information.
|
||||
}
|
||||
|
||||
func makeDagNodeLinkResults(req *cmds.Request, dagnode ipld.Node) <-chan unixfs.LinkResult {
|
||||
linkResults := make(chan unixfs.LinkResult)
|
||||
go func() {
|
||||
defer close(linkResults)
|
||||
for _, l := range dagnode.Links() {
|
||||
select {
|
||||
case linkResults <- unixfs.LinkResult{
|
||||
Link: l,
|
||||
Err: nil,
|
||||
}:
|
||||
case <-req.Context.Done():
|
||||
return
|
||||
}
|
||||
links := dagnode.Links()
|
||||
linkResults := make(chan unixfs.LinkResult, len(links))
|
||||
defer close(linkResults)
|
||||
for _, l := range links {
|
||||
linkResults <- unixfs.LinkResult{
|
||||
Link: l,
|
||||
Err: nil,
|
||||
}
|
||||
}()
|
||||
}
|
||||
return linkResults
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user