cleanup unused code and fix t.Fatal usage in goroutine in testing (#11694)

This commit is contained in:
Mayo
2021-09-30 19:33:14 +08:00
committed by GitHub
parent d58b9c36e1
commit b834c518e2
20 changed files with 91 additions and 91 deletions

View File

@@ -261,13 +261,13 @@ func humanDuration(d time.Duration) string {
// humanDurationInt prints the given int as if it were a time.Duration number
// of seconds.
func humanDurationInt(i interface{}) interface{} {
switch i.(type) {
switch i := i.(type) {
case int:
return humanDuration(time.Duration(i.(int)) * time.Second)
return humanDuration(time.Duration(i) * time.Second)
case int64:
return humanDuration(time.Duration(i.(int64)) * time.Second)
return humanDuration(time.Duration(i) * time.Second)
case json.Number:
if i, err := i.(json.Number).Int64(); err == nil {
if i, err := i.Int64(); err == nil {
return humanDuration(time.Duration(i) * time.Second)
}
}