param rename
Vladimir Bauer
7 years ago
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // SetTotal sets total dynamically. |
| 178 | // Set toComplete to true, to trigger bar complete event now. | |
| 179 | func (b *Bar) SetTotal(total int64, toComplete bool) { | |
| 178 | // Set complete to true, to trigger bar complete event now. | |
| 179 | func (b *Bar) SetTotal(total int64, complete bool) { | |
| 180 | 180 | select { |
| 181 | 181 | case b.operateState <- func(s *bState) { |
| 182 | 182 | s.total = total |
| 183 | if toComplete && !s.toComplete { | |
| 183 | if complete && !s.toComplete { | |
| 184 | 184 | s.current = s.total |
| 185 | 185 | s.toComplete = true |
| 186 | 186 | go b.refreshNowTillShutdown() |