don't pass total it's global const
Vladimir Bauer
4 years ago
| 31 | 31 | bar := p.AddBar(total) |
| 32 | 32 | switch j { |
| 33 | 33 | case n - 1: |
| 34 | complete(b, bar, total) | |
| 34 | complete(b, bar) | |
| 35 | 35 | default: |
| 36 | 36 | wg.Add(1) |
| 37 | 37 | go func() { |
| 38 | complete(b, bar, total) | |
| 38 | complete(b, bar) | |
| 39 | 39 | wg.Done() |
| 40 | 40 | }() |
| 41 | 41 | } |
| 45 | 45 | p.Wait() |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | func complete(b *testing.B, bar *Bar, total int) { | |
| 48 | func complete(b *testing.B, bar *Bar) { | |
| 49 | 49 | for i := 0; i < total; i++ { |
| 50 | 50 | bar.Increment() |
| 51 | 51 | } |