diff --git a/bar_test.go b/bar_test.go index c5020bc..a25b9f2 100644 --- a/bar_test.go +++ b/bar_test.go @@ -14,7 +14,7 @@ ) func TestBarCompleted(t *testing.T) { - p := mpb.New(mpb.Output(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(ioutil.Discard)) total := 80 bar := p.AddBar(int64(total)) @@ -32,7 +32,7 @@ } func TestBarID(t *testing.T) { - p := mpb.New(mpb.Output(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(ioutil.Discard)) numBars := 3 bars := make([]*mpb.Bar, numBars) @@ -60,7 +60,7 @@ width := 100 p := mpb.New( - mpb.Output(&buf), + mpb.WithOutput(&buf), mpb.WithWidth(width), ) @@ -91,7 +91,7 @@ func TestBarPanics(t *testing.T) { var wg sync.WaitGroup var buf bytes.Buffer - p := mpb.New(mpb.Output(&buf), mpb.WithWaitGroup(&wg)) + p := mpb.New(mpb.WithOutput(&buf), mpb.WithWaitGroup(&wg)) wantPanic := "Upps!!!" numBars := 3 diff --git a/barbench_test.go b/barbench_test.go index c1ea326..361c5de 100644 --- a/barbench_test.go +++ b/barbench_test.go @@ -6,7 +6,7 @@ ) func benchmarkSingleBar(total int) { - p := New(Output(ioutil.Discard)) + p := New(WithOutput(ioutil.Discard)) bar := p.AddBar(int64(total)) for i := 0; i < total; i++ { bar.Increment() @@ -33,7 +33,7 @@ } func BenchmarkIncrSingleBar(b *testing.B) { - p := New(Output(ioutil.Discard)) + p := New(WithOutput(ioutil.Discard)) bar := p.AddBar(int64(b.N)) for i := 0; i < b.N; i++ { bar.Increment() diff --git a/options.go b/options.go index 2e009c3..0b0bee4 100644 --- a/options.go +++ b/options.go @@ -69,8 +69,8 @@ } } -// Output overrides default output os.Stdout -func Output(w io.Writer) ProgressOption { +// WithOutput overrides default output os.Stdout +func WithOutput(w io.Writer) ProgressOption { return func(s *pState) { if w == nil { w = ioutil.Discard @@ -79,10 +79,10 @@ } } -// OutputInterceptors provides a way to write to the underlying progress pool's +// WithInterceptors provides a way to write to the underlying progress pool's // writer. Could be useful if you want to output something below the bars, while // they're rendering. -func OutputInterceptors(interseptors ...func(io.Writer)) ProgressOption { +func WithInterceptors(interseptors ...func(io.Writer)) ProgressOption { return func(s *pState) { s.interceptors = interseptors } diff --git a/progress_go1.7_test.go b/progress_go1.7_test.go index 81a00ec..987cd52 100644 --- a/progress_go1.7_test.go +++ b/progress_go1.7_test.go @@ -15,7 +15,7 @@ ctx, cancel := context.WithCancel(context.Background()) shutdown := make(chan struct{}) p := mpb.New( - mpb.Output(ioutil.Discard), + mpb.WithOutput(ioutil.Discard), mpb.WithContext(ctx), mpb.WithShutdownNotifier(shutdown), ) diff --git a/progress_test.go b/progress_test.go index b12a24b..44783a6 100644 --- a/progress_test.go +++ b/progress_test.go @@ -18,7 +18,7 @@ } func TestBarCount(t *testing.T) { - p := mpb.New(mpb.Output(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(ioutil.Discard)) var wg sync.WaitGroup wg.Add(1) @@ -44,7 +44,7 @@ } func TestBarAbort(t *testing.T) { - p := mpb.New(mpb.Output(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(ioutil.Discard)) var wg sync.WaitGroup wg.Add(1) @@ -78,7 +78,7 @@ cancel := make(chan struct{}) shutdown := make(chan struct{}) p := mpb.New( - mpb.Output(ioutil.Discard), + mpb.WithOutput(ioutil.Discard), mpb.WithCancel(cancel), mpb.WithShutdownNotifier(shutdown), ) @@ -118,7 +118,7 @@ cancel := make(chan struct{}) customFormat := "╢▌▌░╟" p := mpb.New( - mpb.Output(&buf), + mpb.WithOutput(&buf), mpb.WithCancel(cancel), mpb.WithFormat(customFormat), ) @@ -152,7 +152,7 @@ customWidth := 60 customFormat := "(#>=_)" p := mpb.New( - mpb.Output(&buf), + mpb.WithOutput(&buf), mpb.WithWidth(customWidth), mpb.WithFormat(customFormat), ) diff --git a/proxyreader_test.go b/proxyreader_test.go index abcfd42..c85fb2e 100644 --- a/proxyreader_test.go +++ b/proxyreader_test.go @@ -22,7 +22,7 @@ func TestProxyReader(t *testing.T) { var buf bytes.Buffer - p := mpb.New(mpb.Output(&buf)) + p := mpb.New(mpb.WithOutput(&buf)) reader := strings.NewReader(content) @@ -50,7 +50,7 @@ func TestProxyReaderCloser(t *testing.T) { var buf bytes.Buffer - p := mpb.New(mpb.Output(&buf)) + p := mpb.New(mpb.WithOutput(&buf)) ts := setupTestHttpServer(content) defer ts.Close()