diff --git a/README.md b/README.md index cc000b5..6ab81d0 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ total := 100 name := "Single Bar:" - startBlock := make(chan time.Time) + sbEta := make(chan time.Time) // adding a single bar bar := p.AddBar(int64(total), mpb.PrependDecorators( @@ -48,7 +48,7 @@ // replace ETA decorator with "done" message, OnComplete event decor.OnComplete( // ETA decorator with default eta age, and width reservation of 4 - decor.ETA(decor.ET_STYLE_GO, 0, startBlock, decor.WC{W: 4}), "done", + decor.ETA(decor.ET_STYLE_GO, 0, sbEta, decor.WC{W: 4}), "done", ), ), mpb.AppendDecorators(decor.Percentage()), @@ -58,7 +58,7 @@ max := 100 * time.Millisecond for i := 0; i < total; i++ { // update start block time, required for ETA calculation - startBlock <- time.Now() + sbEta <- time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) // increment by 1 (there is bar.IncrBy(int) method, if needed) bar.Increment() @@ -76,7 +76,7 @@ for i := 0; i < numBars; i++ { name := fmt.Sprintf("Bar#%d:", i) - startBlock := make(chan time.Time) + sbEta := make(chan time.Time) bar := p.AddBar(int64(total), mpb.PrependDecorators( // display our name with one space on the right @@ -88,7 +88,7 @@ // replace ETA decorator with "done" message, OnComplete event decor.OnComplete( // ETA decorator with default eta age, and width reservation of 3 - decor.ETA(decor.ET_STYLE_GO, 0, startBlock, decor.WC{W: 3}), "done", + decor.ETA(decor.ET_STYLE_GO, 0, sbEta, decor.WC{W: 3}), "done", ), ), ) @@ -97,7 +97,7 @@ defer wg.Done() max := 100 * time.Millisecond for i := 0; i < total; i++ { - startBlock <- time.Now() + sbEta <- time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) bar.Increment() } diff --git a/examples/simple/main.go b/examples/simple/main.go index 4f009d1..0566b79 100644 --- a/examples/simple/main.go +++ b/examples/simple/main.go @@ -22,7 +22,7 @@ for i := 0; i < numBars; i++ { name := fmt.Sprintf("Bar#%d:", i) - startBlock := make(chan time.Time) + sbEta := make(chan time.Time) bar := p.AddBar(int64(total), mpb.PrependDecorators( // display our name with one space on the right @@ -34,7 +34,7 @@ // replace ETA decorator with "done" message, OnComplete event decor.OnComplete( // ETA decorator with default eta age, and width reservation of 3 - decor.ETA(decor.ET_STYLE_GO, 0, startBlock, decor.WC{W: 3}), "done", + decor.ETA(decor.ET_STYLE_GO, 0, sbEta, decor.WC{W: 3}), "done", ), ), ) @@ -43,7 +43,7 @@ defer wg.Done() max := 100 * time.Millisecond for i := 0; i < total; i++ { - startBlock <- time.Now() + sbEta <- time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) bar.Increment() } diff --git a/examples/singleBar/main.go b/examples/singleBar/main.go index 60f9e2b..43cc746 100644 --- a/examples/singleBar/main.go +++ b/examples/singleBar/main.go @@ -20,7 +20,7 @@ total := 100 name := "Single Bar:" - startBlock := make(chan time.Time) + sbEta := make(chan time.Time) // adding a single bar bar := p.AddBar(int64(total), mpb.PrependDecorators( @@ -29,7 +29,7 @@ // replace ETA decorator with "done" message, OnComplete event decor.OnComplete( // ETA decorator with default eta age, and width reservation of 4 - decor.ETA(decor.ET_STYLE_GO, 0, startBlock, decor.WC{W: 4}), "done", + decor.ETA(decor.ET_STYLE_GO, 0, sbEta, decor.WC{W: 4}), "done", ), ), mpb.AppendDecorators(decor.Percentage()), @@ -39,7 +39,7 @@ max := 100 * time.Millisecond for i := 0; i < total; i++ { // update start block time, required for ETA calculation - startBlock <- time.Now() + sbEta <- time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) // increment by 1 (there is bar.IncrBy(int) method, if needed) bar.Increment()