diff --git a/bar.go b/bar.go index d07dc16..35644a4 100644 --- a/bar.go +++ b/bar.go @@ -165,12 +165,12 @@ } // SetTotal sets total dynamically. -// If total is less than or equal to zero it takes progress' current value. +// If total is negative it takes progress' current value. func (b *Bar) SetTotal(total int64, triggerComplete bool) { select { case b.operateState <- func(s *bState) { s.triggerComplete = triggerComplete - if total <= 0 { + if total < 0 { s.total = s.current } else { s.total = total diff --git a/proxyreader.go b/proxyreader.go index 2f20053..a16f5ec 100644 --- a/proxyreader.go +++ b/proxyreader.go @@ -15,7 +15,7 @@ n, err := x.ReadCloser.Read(p) x.bar.IncrBy(n) if err == io.EOF { - go x.bar.SetTotal(0, true) + go x.bar.SetTotal(-1, true) } return n, err } @@ -30,7 +30,7 @@ n, err := x.wt.WriteTo(w) x.bar.IncrInt64(n) if err == io.EOF { - go x.bar.SetTotal(0, true) + go x.bar.SetTotal(-1, true) } return n, err }