diff --git a/go.mod b/go.mod index b7d0a20ee5..b12e39f1b0 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/spf13/cobra v1.9.1 github.com/spf13/pflag v1.0.6 github.com/stretchr/testify v1.10.0 - github.com/vbauerster/mpb/v8 v8.10.0 + github.com/vbauerster/mpb/v8 v8.10.1 github.com/vishvananda/netlink v1.3.1 go.etcd.io/bbolt v1.4.0 golang.org/x/crypto v0.38.0 diff --git a/go.sum b/go.sum index f59e9c5c4b..31f409a7e8 100644 --- a/go.sum +++ b/go.sum @@ -479,8 +479,8 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo= github.com/vbatts/tar-split v0.12.1/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA= -github.com/vbauerster/mpb/v8 v8.10.0 h1:5ZYEWM4ovaZGAibjzW4PlQNb5k+JpzMqVwgNyk+K0M8= -github.com/vbauerster/mpb/v8 v8.10.0/go.mod h1:DYPFebxSahB+f7tuEUGauLQ7w8ij3wMr4clsVuJCV4I= +github.com/vbauerster/mpb/v8 v8.10.1 h1:t/ZFv/NYgoBUy2LrmkD5Vc25r+JhoS4+gRkjVbolO2Y= +github.com/vbauerster/mpb/v8 v8.10.1/go.mod h1:+Ja4P92E3/CorSZgfDtK46D7AVbDqmBQRTmyTqPElo0= github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0= github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4= github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY= diff --git a/vendor/github.com/vbauerster/mpb/v8/README.md b/vendor/github.com/vbauerster/mpb/v8/README.md index af97c92a75..05088f246e 100644 --- a/vendor/github.com/vbauerster/mpb/v8/README.md +++ b/vendor/github.com/vbauerster/mpb/v8/README.md @@ -104,14 +104,14 @@ func main() { p.Wait() ``` -#### [Dynamic total](_examples/dynTotal/main.go) +#### [dynTotal example](_examples/dynTotal/main.go) -![dynamic total](_svg/godEMrCZmJkHYH1X9dN4Nm0U7.svg) +![dynTotal](_svg/godEMrCZmJkHYH1X9dN4Nm0U7.svg) -#### [Complex example](_examples/complex/main.go) +#### [complex example](_examples/complex/main.go) ![complex](_svg/wHzf1M7sd7B3zVa2scBMnjqRf.svg) -#### [Bytes counters](_examples/io/main.go) +#### [io example](_examples/io/main.go) -![byte counters](_svg/hIpTa3A5rQz65ssiVuRJu87X6.svg) +![io](_svg/hIpTa3A5rQz65ssiVuRJu87X6.svg) diff --git a/vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go b/vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go index 0075c18a8f..bc51eb26f2 100644 --- a/vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go +++ b/vendor/github.com/vbauerster/mpb/v8/bar_filler_bar.go @@ -10,15 +10,15 @@ import ( const ( iLbound = iota - iRbound iRefiller iFiller iTip iPadding + iRbound iLen ) -var defaultBarStyle = [iLen]string{"[", "]", "+", "=", ">", "-"} +var defaultBarStyle = [iLen]string{"[", "+", "=", ">", "-", "]"} // BarStyleComposer interface. type BarStyleComposer interface { @@ -86,9 +86,7 @@ func (s barStyle) Lbound(bound string) BarStyleComposer { } func (s barStyle) LboundMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iLbound] = fn - } + s.metas[iLbound] = fn return s } @@ -98,9 +96,7 @@ func (s barStyle) Rbound(bound string) BarStyleComposer { } func (s barStyle) RboundMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iRbound] = fn - } + s.metas[iRbound] = fn return s } @@ -110,9 +106,7 @@ func (s barStyle) Filler(filler string) BarStyleComposer { } func (s barStyle) FillerMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iFiller] = fn - } + s.metas[iFiller] = fn return s } @@ -122,9 +116,7 @@ func (s barStyle) Refiller(refiller string) BarStyleComposer { } func (s barStyle) RefillerMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iRefiller] = fn - } + s.metas[iRefiller] = fn return s } @@ -134,9 +126,7 @@ func (s barStyle) Padding(padding string) BarStyleComposer { } func (s barStyle) PaddingMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iPadding] = fn - } + s.metas[iPadding] = fn return s } @@ -148,9 +138,7 @@ func (s barStyle) Tip(frames ...string) BarStyleComposer { } func (s barStyle) TipMeta(fn func(string) string) BarStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.metas[iTip] = fn - } + s.metas[iTip] = fn return s } @@ -247,11 +235,11 @@ func (s *barFiller) Fill(w io.Writer, stat decor.Statistics) error { return s.flushOp(barSections{ {s.metas[iLbound], s.components[iLbound].bytes}, - {s.metas[iRbound], s.components[iRbound].bytes}, {s.metas[iRefiller], refilling}, {s.metas[iFiller], filling}, {s.metas[iTip], tip.bytes}, {s.metas[iPadding], padding}, + {s.metas[iRbound], s.components[iRbound].bytes}, }, w) } @@ -265,30 +253,22 @@ func (s barSection) flush(w io.Writer) (err error) { } func (bb barSections) flush(w io.Writer) error { - err := bb[0].flush(w) - if err != nil { - return err - } - for _, s := range bb[2:] { + for _, s := range bb { err := s.flush(w) if err != nil { return err } } - return bb[1].flush(w) + return nil } func (bb barSections) flushRev(w io.Writer) error { - err := bb[0].flush(w) - if err != nil { - return err - } - ss := bb[2:] - for i := len(ss) - 1; i >= 0; i-- { - err := ss[i].flush(w) + bb[0], bb[len(bb)-1] = bb[len(bb)-1], bb[0] + for i := len(bb) - 1; i >= 0; i-- { + err := bb[i].flush(w) if err != nil { return err } } - return bb[1].flush(w) + return nil } diff --git a/vendor/github.com/vbauerster/mpb/v8/bar_filler_spinner.go b/vendor/github.com/vbauerster/mpb/v8/bar_filler_spinner.go index d89de94ce4..56075810c6 100644 --- a/vendor/github.com/vbauerster/mpb/v8/bar_filler_spinner.go +++ b/vendor/github.com/vbauerster/mpb/v8/bar_filler_spinner.go @@ -40,7 +40,7 @@ type spinnerStyle struct { // SpinnerStyle constructs default spinner style which can be altered via // SpinnerStyleComposer interface. func SpinnerStyle(frames ...string) SpinnerStyleComposer { - ss := spinnerStyle{meta: func(s string) string { return s }} + var ss spinnerStyle if len(frames) != 0 { ss.frames = frames } else { @@ -60,17 +60,12 @@ func (s spinnerStyle) PositionRight() SpinnerStyleComposer { } func (s spinnerStyle) Meta(fn func(string) string) SpinnerStyleComposer { - if fn != nil && len(fn("")) != 0 { - s.meta = fn - } + s.meta = fn return s } func (s spinnerStyle) Build() BarFiller { - sf := &spinnerFiller{ - frames: s.frames, - meta: s.meta, - } + sf := &spinnerFiller{frames: s.frames} switch s.position { case positionLeft: sf.position = func(frame string, padWidth int) string { @@ -85,6 +80,11 @@ func (s spinnerStyle) Build() BarFiller { return strings.Repeat(" ", padWidth/2) + frame + strings.Repeat(" ", padWidth/2+padWidth%2) } } + if s.meta != nil { + sf.meta = s.meta + } else { + sf.meta = func(s string) string { return s } + } return sf } diff --git a/vendor/github.com/vbauerster/mpb/v8/heap_manager.go b/vendor/github.com/vbauerster/mpb/v8/heap_manager.go index 23e24d8269..88efb4823c 100644 --- a/vendor/github.com/vbauerster/mpb/v8/heap_manager.go +++ b/vendor/github.com/vbauerster/mpb/v8/heap_manager.go @@ -41,7 +41,7 @@ func (m heapManager) run() { var bHeap priorityQueue var pMatrix, aMatrix map[int][]chan int - var len int + var l int var sync bool for req := range m { @@ -51,7 +51,7 @@ func (m heapManager) run() { heap.Push(&bHeap, data.bar) sync = sync || data.sync case h_sync: - if sync || len != bHeap.Len() { + if sync || l != bHeap.Len() { pMatrix = make(map[int][]chan int) aMatrix = make(map[int][]chan int) for _, b := range bHeap { @@ -64,7 +64,7 @@ func (m heapManager) run() { } } sync = false - len = bHeap.Len() + l = bHeap.Len() } drop := req.data.(<-chan struct{}) syncWidth(pMatrix, drop) @@ -106,7 +106,7 @@ func (m heapManager) run() { } case h_state: ch := req.data.(chan<- bool) - ch <- sync || len != bHeap.Len() + ch <- sync || l != bHeap.Len() case h_end: ch := req.data.(chan<- interface{}) if ch != nil { diff --git a/vendor/github.com/vbauerster/mpb/v8/priority_queue.go b/vendor/github.com/vbauerster/mpb/v8/priority_queue.go index 0863b5787b..a93b1e5904 100644 --- a/vendor/github.com/vbauerster/mpb/v8/priority_queue.go +++ b/vendor/github.com/vbauerster/mpb/v8/priority_queue.go @@ -20,18 +20,18 @@ func (pq priorityQueue) Swap(i, j int) { } func (pq *priorityQueue) Push(x interface{}) { - n := len(*pq) + s := *pq bar := x.(*Bar) - bar.index = n - *pq = append(*pq, bar) + bar.index = len(s) + *pq = append(s, bar) } func (pq *priorityQueue) Pop() interface{} { - old := *pq - n := len(old) - bar := old[n-1] - old[n-1] = nil // avoid memory leak + s := *pq + l := len(s) + bar := s[l-1] bar.index = -1 // for safety - *pq = old[:n-1] + s[l-1] = nil // avoid memory leak + *pq = s[:l-1] return bar } diff --git a/vendor/modules.txt b/vendor/modules.txt index 59b9c7bd58..1b88e5af90 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -990,7 +990,7 @@ github.com/ulikunitz/xz/lzma github.com/vbatts/tar-split/archive/tar github.com/vbatts/tar-split/tar/asm github.com/vbatts/tar-split/tar/storage -# github.com/vbauerster/mpb/v8 v8.10.0 +# github.com/vbauerster/mpb/v8 v8.10.1 ## explicit; go 1.23.0 github.com/vbauerster/mpb/v8 github.com/vbauerster/mpb/v8/cwriter