I am implementing a progress bar using your great repo, but I got stuck on the following situation. The speed field and left time field remains zero while the program is running, could you please help me to figure out where I am wrong? Thank you so much!
Sample code
package main
import (
"time"
"github.com/vbauerster/mpb/v5"
"github.com/vbauerster/mpb/v5/decor"
)
func main() {
var totalBytes int64 = 1024
p := mpb.New(
mpb.WithWidth(60),
mpb.WithRefreshRate(180*time.Millisecond),
)
bar := p.AddBar(totalBytes, mpb.BarStyle("[=>-|"),
mpb.PrependDecorators(
decor.CountersKibiByte("% .2f / % .2f"),
),
mpb.AppendDecorators(
decor.EwmaETA(decor.ET_STYLE_GO, 90),
decor.Name(" ] "),
decor.EwmaSpeed(decor.UnitKiB, "% .2f", 60),
),
)
for i := 0; i < 1024; i++ {
bar.Increment()
time.Sleep(1 * time.Second)
}
p.Wait()
}
Current output after 4s running
4.00 b / 1.00 KiB [----------------------------------------------------------| 0s ] 0.00 b/s
Expected output after 4s running
4.00 b / 1.00 KiB [----------------------------------------------------------| 1020s ] 1.00 b/s
Description
I am implementing a progress bar using your great repo, but I got stuck on the following situation. The speed field and left time field remains zero while the program is running, could you please help me to figure out where I am wrong? Thank you so much!
Sample code
Current output after 4s running
Expected output after 4s running