Skip to content

Commit

Permalink
keep the order of error (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang0 authored Sep 29, 2023
1 parent fb44089 commit 9d7defb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions resource/cobalt/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ func call[T any](ctx context.Context, ps []plugins.Plugin, f func(plugins.Plugin
}
wg.Wait()
ans := make(map[plugins.Plugin]T)
results.Range(func(key, value any) bool {
for _, p := range ps {
value, _ := results.Load(p)
switch vt := value.(type) {
case error:
combinedErr = errors.CombineErrors(combinedErr, vt)
case T:
ans[key.(plugins.Plugin)] = vt
ans[p] = vt
}
return true
})
}
return ans, combinedErr
}

0 comments on commit 9d7defb

Please sign in to comment.