diff --git a/bar_test.go b/bar_test.go index 27fd091..7f6b3f6 100644 --- a/bar_test.go +++ b/bar_test.go @@ -4,7 +4,7 @@ "bytes" "context" "fmt" - "io/ioutil" + "io" "strings" "sync/atomic" "testing" @@ -16,7 +16,7 @@ ) func TestBarCompleted(t *testing.T) { - p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) total := 80 bar := p.AddBar(int64(total)) @@ -34,7 +34,7 @@ } func TestBarAborted(t *testing.T) { - p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) total := 80 bar := p.AddBar(int64(total)) @@ -52,7 +52,7 @@ } func TestBarEnableTriggerCompleteAndIncrementBefore(t *testing.T) { - p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) bar := p.AddBar(0) // never complete bar for _, f := range []func(){ @@ -77,7 +77,7 @@ } func TestBarEnableTriggerCompleteAndIncrementAfter(t *testing.T) { - p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) bar := p.AddBar(0) // never complete bar for _, f := range []func(){ @@ -102,7 +102,7 @@ } func TestBarID(t *testing.T) { - p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) total := 100 wantID := 11 bar := p.AddBar(int64(total), mpb.BarID(wantID)) @@ -204,7 +204,7 @@ p := mpb.New( mpb.WithWidth(80), mpb.WithDebugOutput(&buf), - mpb.WithOutput(ioutil.Discard), + mpb.WithOutput(io.Discard), ) total := 100 @@ -241,7 +241,7 @@ p := mpb.New( mpb.WithWidth(80), mpb.WithDebugOutput(&buf), - mpb.WithOutput(ioutil.Discard), + mpb.WithOutput(io.Discard), ) total := 100 @@ -293,7 +293,7 @@ refresh := make(chan interface{}) p := mpb.NewWithContext(ctx, mpb.WithWidth(100), mpb.WithManualRefresh(refresh), - mpb.WithOutput(ioutil.Discard), + mpb.WithOutput(io.Discard), ) _ = p.AddBar(0, mpb.BarFillerTrim(), diff --git a/container_option.go b/container_option.go index bfaa328..38239d4 100644 --- a/container_option.go +++ b/container_option.go @@ -2,7 +2,6 @@ import ( "io" - "io/ioutil" "sync" "time" ) @@ -74,7 +73,7 @@ func WithOutput(w io.Writer) ContainerOption { return func(s *pState) { if w == nil { - s.output = ioutil.Discard + s.output = io.Discard s.outputDiscarded = true return } diff --git a/cwriter/cuuAndEd_construction_bench_test.go b/cwriter/cuuAndEd_construction_bench_test.go index 2abbec3..996d5a8 100644 --- a/cwriter/cuuAndEd_construction_bench_test.go +++ b/cwriter/cuuAndEd_construction_bench_test.go @@ -3,13 +3,13 @@ import ( "bytes" "fmt" - "io/ioutil" + "io" "strconv" "testing" ) var ( - out = ioutil.Discard + out = io.Discard lines = 99 ) diff --git a/example_test.go b/example_test.go index ba8965e..a76a6ec 100644 --- a/example_test.go +++ b/example_test.go @@ -3,7 +3,6 @@ import ( crand "crypto/rand" "io" - "io/ioutil" "math/rand" "time" @@ -78,7 +77,7 @@ defer proxyReader.Close() // and copy from reader, ignoring errors - _, _ = io.Copy(ioutil.Discard, proxyReader) + _, _ = io.Copy(io.Discard, proxyReader) p.Wait() } diff --git a/progress_test.go b/progress_test.go index 9cb4771..9f3227c 100644 --- a/progress_test.go +++ b/progress_test.go @@ -2,7 +2,7 @@ import ( "context" - "io/ioutil" + "io" "math/rand" "testing" "time" @@ -21,7 +21,7 @@ func TestBarCount(t *testing.T) { shutdown := make(chan struct{}) - p := mpb.New(mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard)) b := p.AddBar(0, mpb.BarRemoveOnComplete()) @@ -48,7 +48,7 @@ func TestBarAbort(t *testing.T) { shutdown := make(chan struct{}) - p := mpb.New(mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard)) n := 2 bars := make([]*mpb.Bar, n) for i := 0; i < n; i++ { @@ -97,7 +97,7 @@ func TestWithContext(t *testing.T) { shutdown := make(chan struct{}) ctx, cancel := context.WithCancel(context.Background()) - p := mpb.NewWithContext(ctx, mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(ioutil.Discard)) + p := mpb.NewWithContext(ctx, mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard)) done := make(chan struct{}) bar := p.AddBar(0) // never complete bar @@ -139,7 +139,7 @@ total := 100 numBars := 6 - p := mpb.New(mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(io.Discard)) for i := 0; i < numBars; i++ { bar := p.AddBar(int64(total), mpb.BarOptional(mpb.BarRemoveOnComplete(), i == 0), diff --git a/proxyreader.go b/proxyreader.go index b0dd89d..51b63ea 100644 --- a/proxyreader.go +++ b/proxyreader.go @@ -2,7 +2,6 @@ import ( "io" - "io/ioutil" "time" ) @@ -76,5 +75,5 @@ if rc, ok := r.(io.ReadCloser); ok { return rc } - return ioutil.NopCloser(r) + return io.NopCloser(r) } diff --git a/proxyreader_test.go b/proxyreader_test.go index 4482f5a..0f7f058 100644 --- a/proxyreader_test.go +++ b/proxyreader_test.go @@ -3,7 +3,6 @@ import ( "bytes" "io" - "io/ioutil" "strings" "testing" @@ -39,7 +38,7 @@ } func TestProxyReader(t *testing.T) { - p := mpb.New(mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(io.Discard)) tReader := &testReader{strings.NewReader(content), false} @@ -63,7 +62,7 @@ } func TestProxyWriterTo(t *testing.T) { - p := mpb.New(mpb.WithOutput(ioutil.Discard)) + p := mpb.New(mpb.WithOutput(io.Discard)) var reader io.Reader = strings.NewReader(content) tWriterTo := testWriterTo{&testReader{reader, false}, reader.(io.WriterTo)}