diff --git a/bar.go b/bar.go index 0f8305a..2796f97 100644 --- a/bar.go +++ b/bar.go @@ -42,7 +42,7 @@ runningBar *Bar cacheState *bState operateState chan func(*bState) - cmdValue chan int + cmdValue chan uint frameReaderCh chan io.Reader // done is closed by Bar's goroutine, after cacheState is written @@ -117,7 +117,7 @@ priority: s.priority, runningBar: s.runningBar, operateState: make(chan func(*bState)), - cmdValue: make(chan int), + cmdValue: make(chan uint), frameReaderCh: make(chan io.Reader, 1), done: make(chan struct{}), shutdown: make(chan struct{}), @@ -160,7 +160,7 @@ func (b *Bar) NumOfAppenders() int { select { case b.cmdValue <- cmdALen: - return <-b.cmdValue + return int(<-b.cmdValue) case <-b.done: return len(b.cacheState.aDecorators) } @@ -170,7 +170,7 @@ func (b *Bar) NumOfPrependers() int { select { case b.cmdValue <- cmdPLen: - return <-b.cmdValue + return int(<-b.cmdValue) case <-b.done: return len(b.cacheState.pDecorators) } @@ -180,7 +180,7 @@ func (b *Bar) ID() int { select { case b.cmdValue <- cmdId: - return <-b.cmdValue + return int(<-b.cmdValue) case <-b.done: return b.cacheState.id } @@ -273,17 +273,17 @@ case cmd := <-b.cmdValue: switch { case cmd&cmdId != 0: - b.cmdValue <- s.id + b.cmdValue <- uint(s.id) case cmd&cmdTotal != 0: - b.cmdValue <- int(s.total) + b.cmdValue <- uint(s.total) case cmd&cmdCurrent != 0: - b.cmdValue <- int(s.current) + b.cmdValue <- uint(s.current) case cmd&cmdPLen != 0: - b.cmdValue <- len(s.pDecorators) + b.cmdValue <- uint(len(s.pDecorators)) case cmd&cmdALen != 0: - b.cmdValue <- len(s.aDecorators) + b.cmdValue <- uint(len(s.aDecorators)) case cmd&cmdCompleted != 0: - var v int + var v uint if s.toComplete { v = 1 }