fix: added panic if type assertions failed
Этот коммит содержится в:
родитель
b730b9fd4b
коммит
0d22f34c56
1 изменённых файлов: 25 добавлений и 22 удалений
13
run.go
13
run.go
|
@ -72,9 +72,10 @@ func (r *runner) concurrent(rate int, formatterFn func() Formatter) (failed bool
|
|||
}
|
||||
if useFmtCopy {
|
||||
copyLock.Lock()
|
||||
if d, ok := r.fmt.(*progress); ok {
|
||||
if s, ok := fmtCopy.(*progress); ok {
|
||||
func(source *progress, dest *progress) {
|
||||
dest, dOk := r.fmt.(*progress)
|
||||
source, sOk := fmtCopy.(*progress)
|
||||
|
||||
if dOk && sOk {
|
||||
for _, v := range source.features {
|
||||
dest.features = append(dest.features, v)
|
||||
}
|
||||
|
@ -94,8 +95,10 @@ func (r *runner) concurrent(rate int, formatterFn func() Formatter) (failed bool
|
|||
for _, v := range source.pending {
|
||||
dest.pending = append(dest.pending, v)
|
||||
}
|
||||
}(s, d)
|
||||
}
|
||||
} else if !dOk {
|
||||
panic("cant cast dest formatter to progress-typed")
|
||||
} else if !sOk {
|
||||
panic("cant cast source formatter to progress-typed")
|
||||
}
|
||||
copyLock.Unlock()
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче