diff --git a/bar_test.go b/bar_test.go index 33f7e95..b442195 100644 --- a/bar_test.go +++ b/bar_test.go @@ -10,8 +10,8 @@ "time" "unicode/utf8" - . "github.com/vbauerster/mpb/v4" - "github.com/vbauerster/mpb/v4/decor" + . "github.com/vbauerster/mpb/v5" + "github.com/vbauerster/mpb/v5/decor" ) func TestBarCompleted(t *testing.T) { diff --git a/barbench_test.go b/barbench_test.go index ae84322..53a8141 100644 --- a/barbench_test.go +++ b/barbench_test.go @@ -4,7 +4,7 @@ "io/ioutil" "testing" - "github.com/vbauerster/mpb/v4/decor" + "github.com/vbauerster/mpb/v5/decor" ) func BenchmarkIncrSingleBar(b *testing.B) { diff --git a/decorators_test.go b/decorators_test.go index fd02caa..4bc475a 100644 --- a/decorators_test.go +++ b/decorators_test.go @@ -4,8 +4,8 @@ "sync" "testing" - . "github.com/vbauerster/mpb/v4" - "github.com/vbauerster/mpb/v4/decor" + . "github.com/vbauerster/mpb/v5" + "github.com/vbauerster/mpb/v5/decor" ) func TestNameDecorator(t *testing.T) { diff --git a/example_test.go b/example_test.go index a7dd099..ca524cf 100644 --- a/example_test.go +++ b/example_test.go @@ -7,8 +7,8 @@ "math/rand" "time" - "github.com/vbauerster/mpb/v4" - "github.com/vbauerster/mpb/v4/decor" + "github.com/vbauerster/mpb/v5" + "github.com/vbauerster/mpb/v5/decor" ) func Example() { @@ -35,10 +35,13 @@ // simulating some work max := 100 * time.Millisecond for i := 0; i < total; i++ { + // start variable is solely for EWMA calculation + // EWMA's unit of measure is an iteration's taken time start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // since ewma decorator is used, we need to pass time.Since(start) - bar.Increment(time.Since(start)) + bar.Increment() + // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract + bar.DecoratorEwmaUpdate(time.Since(start)) } // wait for our bar to complete and flush p.Wait() diff --git a/progress_test.go b/progress_test.go index 141be24..3390d2c 100644 --- a/progress_test.go +++ b/progress_test.go @@ -9,7 +9,7 @@ "testing" "time" - "github.com/vbauerster/mpb/v4" + "github.com/vbauerster/mpb/v5" ) func init() {