Skip to content

Commit 0a5b1a2

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

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

core/commands/ls.go

+7-13
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,14 @@ 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+
for _, l := range links {
218+
linkResults <- unixfs.LinkResult{
219+
Link: l,
220+
Err: nil,
227221
}
228-
}()
222+
}
229223
return linkResults
230224
}
231225

0 commit comments

Comments
 (0)