diff options
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go')
-rw-r--r-- | vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go b/vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go index 54b7bfd6f..d8bf90a4a 100644 --- a/vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go +++ b/vendor/github.com/vbauerster/mpb/v7/bar_filler_bar.go @@ -157,9 +157,8 @@ func (s *bFiller) Fill(w io.Writer, width int, stat decor.Statistics) { return } - ow := optimisticWriter(w) - ow(s.components[iLbound].bytes) - defer ow(s.components[iRbound].bytes) + mustWrite(w, s.components[iLbound].bytes) + defer mustWrite(w, s.components[iRbound].bytes) if width == 0 { return @@ -231,26 +230,24 @@ func (s *bFiller) Fill(w io.Writer, width int, stat decor.Statistics) { } if s.rev { - flush(ow, padding, filling) + flush(w, padding, filling) } else { - flush(ow, filling, padding) + flush(w, filling, padding) } } -func flush(ow func([]byte), filling, padding [][]byte) { +func flush(w io.Writer, filling, padding [][]byte) { for i := len(filling) - 1; i >= 0; i-- { - ow(filling[i]) + mustWrite(w, filling[i]) } for i := 0; i < len(padding); i++ { - ow(padding[i]) + mustWrite(w, padding[i]) } } -func optimisticWriter(w io.Writer) func([]byte) { - return func(p []byte) { - _, err := w.Write(p) - if err != nil { - panic(err) - } +func mustWrite(w io.Writer, p []byte) { + _, err := w.Write(p) + if err != nil { + panic(err) } } |