fix megacheck errors

This commit is contained in:
Adam Babik 2018-03-29 17:59:42 +02:00 committed by Igor Mandrigin
parent d2df4bb323
commit 37f19d813c
2 changed files with 13 additions and 14 deletions

View File

@ -1477,3 +1477,16 @@ func testValidateNodeConfig(t *testing.T, config string, fn func(APIDetailedResp
fn(resp)
}
// PanicAfter throws panic() after waitSeconds, unless abort channel receives
// notification.
func PanicAfter(waitSeconds time.Duration, abort chan struct{}, desc string) {
go func() {
select {
case <-abort:
return
case <-time.After(waitSeconds):
panic("whatever you were doing takes toooo long: " + desc)
}
}()
}

View File

@ -2,22 +2,8 @@ package main
import (
"encoding/json"
"time"
)
// PanicAfter throws panic() after waitSeconds, unless abort channel receives
// notification.
func PanicAfter(waitSeconds time.Duration, abort chan struct{}, desc string) {
go func() {
select {
case <-abort:
return
case <-time.After(waitSeconds):
panic("whatever you were doing takes toooo long: " + desc)
}
}()
}
// ParseJSONArray parses JSON array into Go array of string.
func ParseJSONArray(items string) ([]string, error) {
var parsedItems []string