diff --git a/bar.go b/bar.go index 8ebe793..6521ffc 100644 --- a/bar.go +++ b/bar.go @@ -42,7 +42,7 @@ // Refil is a struct for b.IncrWithReFill type refill struct { char rune - till int + till int64 } type ( @@ -55,8 +55,8 @@ width int format barFmtRunes etaAlpha float64 - total int - current int + total int64 + current int64 trimLeftSpace bool trimRightSpace bool completed bool @@ -72,7 +72,7 @@ } ) -func newBar(total int, wg *sync.WaitGroup, cancel <-chan struct{}, options ...BarOption) *Bar { +func newBar(total int64, wg *sync.WaitGroup, cancel <-chan struct{}, options ...BarOption) *Bar { s := state{ total: total, etaAlpha: etaAlpha, @@ -137,7 +137,7 @@ s.startTime = time.Now() s.blockStartTime = s.startTime } - sum := s.current + n + sum := s.current + int64(n) s.timeElapsed = time.Since(s.startTime) s.updateTimePerItemEstimate(n) if s.total > 0 && sum >= s.total { @@ -155,7 +155,7 @@ // ResumeFill fills bar with different r rune, // from 0 to till amount of progress. -func (b *Bar) ResumeFill(r rune, till int) { +func (b *Bar) ResumeFill(r rune, till int64) { if till < 1 { return } @@ -370,7 +370,7 @@ return buf } -func fillBar(total, current, width int, fmtBytes barFmtBytes, rf *refill) []byte { +func fillBar(total, current int64, width int, fmtBytes barFmtBytes, rf *refill) []byte { if width < 2 || total <= 0 { return []byte{} } diff --git a/decor/decorators.go b/decor/decorators.go index 4e96b7a..c520946 100644 --- a/decor/decorators.go +++ b/decor/decorators.go @@ -30,8 +30,8 @@ ID int Completed bool Aborted bool - Total int - Current int + Total int64 + Current int64 StartTime time.Time TimeElapsed time.Duration TimePerItemEstimate time.Duration @@ -146,7 +146,7 @@ } } -func CalcPercentage(total, current, width int) int { +func CalcPercentage(total, current int64, width int) int { if total == 0 || current > total { return 0 } diff --git a/decor/format.go b/decor/format.go index 63de955..1a62a54 100644 --- a/decor/format.go +++ b/decor/format.go @@ -27,12 +27,12 @@ type Units uint -func Format(i int) *formatter { +func Format(i int64) *formatter { return &formatter{n: i} } type formatter struct { - n int + n int64 unit Units width int } @@ -58,7 +58,7 @@ } } -func formatKiB(i int) (result string) { +func formatKiB(i int64) (result string) { switch { case i >= TiB: result = fmt.Sprintf("%.1fTiB", float64(i)/TiB) @@ -74,7 +74,7 @@ return } -func formatKB(i int) (result string) { +func formatKB(i int64) (result string) { switch { case i >= TB: result = fmt.Sprintf("%.1fTB", float64(i)/TB) diff --git a/example/prependETA/main.go b/example/prependETA/main.go index c12868d..d91b4c2 100644 --- a/example/prependETA/main.go +++ b/example/prependETA/main.go @@ -28,7 +28,7 @@ if i != 1 { name = fmt.Sprintf("Bar#%d:", i) } - b := p.AddBar(total, + b := p.AddBar(int64(total), mpb.PrependDecorators( decor.Name(name, 0, decor.DwidthSync|decor.DidentRight), decor.ETA(4, decor.DSyncSpace), diff --git a/progress.go b/progress.go index 9c40923..0f1cbc1 100644 --- a/progress.go +++ b/progress.go @@ -83,7 +83,7 @@ } // AddBar creates a new progress bar and adds to the container. -func (p *Progress) AddBar(total int, options ...BarOption) *Bar { +func (p *Progress) AddBar(total int64, options ...BarOption) *Bar { result := make(chan *Bar, 1) op := func(c *pConf) { options = append(options, barWidth(c.width), barFormat(c.format))