merger: Pass pointers, not structs

just in one function, where two of them are passed at once.
This was causing errors because it was too large to fit the stack.
This commit is contained in:
Mike Lang
2016-11-18 18:06:13 -08:00
parent c99b7541cf
commit 7d93e2cfe7

View File

@@ -48,14 +48,15 @@ func (smartMerger) Merge(reports []report.Report) report.Report {
case 1:
return reports[0]
}
c := make(chan report.Report, l)
c := make(chan *report.Report, l)
for _, r := range reports {
c <- r
c <- &r
}
for ; l > 1; l-- {
go func(left, right report.Report) {
c <- left.Merge(right)
go func(left, right *report.Report) {
r := left.Merge(*right)
c <- &r
}(<-c, <-c)
}
return <-c
return *<-c
}