Skip to content

Instantly share code, notes, and snippets.

@macalinao
Created September 16, 2016 05:18
Show Gist options
  • Save macalinao/5372b750810f8aacaa82f200d19f1dec to your computer and use it in GitHub Desktop.
Save macalinao/5372b750810f8aacaa82f200d19f1dec to your computer and use it in GitHub Desktop.
// Create aggregate sum
sum := (*apb.MatchSum)(nil)
go func() {
for sumRow := range sumsChan {
if sum == nil {
sum = &apb.MatchSum{}
}
sum = addMatchSums(sum, sumRow)
}
}()
// Terminate when all sums are fetched
wg.Wait()
close(sumsChan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment