fix megacheck errors
This commit is contained in:
parent
d2df4bb323
commit
37f19d813c
|
@ -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)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
14
lib/utils.go
14
lib/utils.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue