Skip to content

Commit f5ab6a3

Browse files
committed
refactor(commands): cleanup makeDagNodeLinkResults
License: MIT Signed-off-by: hannahhoward <[email protected]>
1 parent b0dc73c commit f5ab6a3

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

core/commands/ls.go

+8-13
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,15 @@ The JSON output contains type information.
212212
}
213213

214214
func makeDagNodeLinkResults(req *cmds.Request, dagnode ipld.Node) <-chan unixfs.LinkResult {
215-
linkResults := make(chan unixfs.LinkResult)
216-
go func() {
217-
defer close(linkResults)
218-
for _, l := range dagnode.Links() {
219-
select {
220-
case linkResults <- unixfs.LinkResult{
221-
Link: l,
222-
Err: nil,
223-
}:
224-
case <-req.Context.Done():
225-
return
226-
}
215+
links := dagnode.Links()
216+
linkResults := make(chan unixfs.LinkResult, len(links))
217+
defer close(linkResults)
218+
for _, l := range links {
219+
linkResults <- unixfs.LinkResult{
220+
Link: l,
221+
Err: nil,
227222
}
228-
}()
223+
}
229224
return linkResults
230225
}
231226

0 commit comments

Comments
 (0)