godoc example: bar.StartBlock()
Vladimir Bauer
8 years ago
| 39 | 39 | // simulating some work |
| 40 | 40 | max := 100 * time.Millisecond |
| 41 | 41 | for i := 0; i < total; i++ { |
| 42 | bar.StartBlock() // optional call, required for ETA | |
| 42 | 43 | time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) |
| 43 | 44 | // increment by 1 (there is bar.IncrBy(int) method, if needed) |
| 44 | 45 | bar.Increment() |