提交 f5ab6a3f 作者: hannahhoward

refactor(commands): cleanup makeDagNodeLinkResults

License: MIT
Signed-off-by: 's avatarhannahhoward <hannah@hannahhoward.net>
上级 b0dc73c4
......@@ -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() {
links := dagnode.Links()
linkResults := make(chan unixfs.LinkResult, len(links))
defer close(linkResults)
for _, l := range dagnode.Links() {
select {
case linkResults <- unixfs.LinkResult{
for _, l := range links {
linkResults <- unixfs.LinkResult{
Link: l,
Err: nil,
}:
case <-req.Context.Done():
return
}
}
}()
return linkResults
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论