aboutsummaryrefslogtreecommitdiff
path: root/internal/progress/meter.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-13 03:32:21 +0000
committerGravatar Runxi Yu2026-06-13 04:59:51 +0000
commitbe63ecd9711b46135bbff1769c2e4c3642255ef1 (patch)
treed5581c8b2e438af2b8ae82dd8f200393b2dbc5d3 /internal/progress/meter.go
parentTODO: Update (diff)
Unify lengths
Diffstat (limited to 'internal/progress/meter.go')
-rw-r--r--internal/progress/meter.go17
1 files changed, 6 insertions, 11 deletions
diff --git a/internal/progress/meter.go b/internal/progress/meter.go
index 0e4138de..e5e64fb4 100644
--- a/internal/progress/meter.go
+++ b/internal/progress/meter.go
@@ -3,7 +3,6 @@ package progress
import (
"time"
- "lindenii.org/go/lgo/intconv"
"lindenii.org/go/lgo/iowrap"
)
@@ -17,7 +16,7 @@ type Meter struct {
writer iowrap.WriteFlusher
title string
- total uint64
+ total int
delay time.Duration
sparse bool
throughput bool
@@ -26,8 +25,8 @@ type Meter struct {
nextUpdateAt time.Time
nextThroughput time.Time
- lastDone uint64
- lastBytes uint64
+ lastDone int
+ lastBytes int
lastPercent int
lastCounterW int
sawValue bool
@@ -58,7 +57,7 @@ type Options struct {
Writer iowrap.WriteFlusher
Title string
- Total uint64
+ Total int
// Delay suppresses progress output until Delay has elapsed since Start.
Delay time.Duration
@@ -70,7 +69,7 @@ type Options struct {
// Set records current progress
// and renders when percent changed or the 1s tick elapsed.
-func (meter *Meter) Set(done uint64, bytes uint64) {
+func (meter *Meter) Set(done int, bytes int) {
meter.lastDone = done
meter.lastBytes = bytes
meter.sawValue = true
@@ -85,11 +84,7 @@ func (meter *Meter) Set(done uint64, bytes uint64) {
percentChanged := false
if meter.total > 0 {
- percent, err := intconv.Uint64ToInt(done * 100 / meter.total)
- if err != nil {
- return // TODO
- }
-
+ percent := int(int64(done) * 100 / int64(meter.total))
percentChanged = percent != meter.lastPercent
}