SetTotal: make sure zero value not assigned
Vladimir Bauer
8 years ago
| 226 | 226 |
func (b *Bar) SetTotal(total int64, final bool) {
|
| 227 | 227 |
select {
|
| 228 | 228 |
case b.operateState <- func(s *bState) {
|
| 229 | |
s.total = total
|
|
229 |
if total != 0 {
|
|
230 |
s.total = total
|
|
231 |
}
|
| 230 | 232 |
s.dynamic = !final
|
| 231 | 233 |
}:
|
| 232 | 234 |
case <-b.done:
|