Fixing test imports (#593)
This commit is contained in:
parent
6728dcf06d
commit
230e4febb1
|
@ -250,7 +250,7 @@ Examples:
|
|||
|
||||
Options:
|
||||
`
|
||||
fmt.Fprintf(os.Stderr, usage) // nolint: gas
|
||||
fmt.Fprint(os.Stderr, usage) // nolint: gas
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
|
||||
|
@ -94,17 +93,6 @@ func PanicAfter(waitSeconds time.Duration, abort chan struct{}, desc string) {
|
|||
}()
|
||||
}
|
||||
|
||||
// NameOf returns name of caller, at runtime
|
||||
func NameOf(f interface{}) string {
|
||||
v := reflect.ValueOf(f)
|
||||
if v.Kind() == reflect.Func {
|
||||
if rf := runtime.FuncForPC(v.Pointer()); rf != nil {
|
||||
return rf.Name()
|
||||
}
|
||||
}
|
||||
return v.String()
|
||||
}
|
||||
|
||||
// MessageIDFromContext returns message id from context (if exists)
|
||||
func MessageIDFromContext(ctx context.Context) string {
|
||||
if ctx == nil {
|
||||
|
@ -143,7 +131,7 @@ func Fatalf(reason interface{}, args ...interface{}) {
|
|||
// find out whether error or string has been passed as a reason
|
||||
r := reflect.ValueOf(reason)
|
||||
if r.Kind() == reflect.String {
|
||||
fmt.Fprintf(w, "Fatal Failure: "+reason.(string)+"\n", args) //nolint: gas
|
||||
fmt.Fprintf(w, "Fatal Failure: %v\n%v\n", reason.(string), args) //nolint: gas
|
||||
} else {
|
||||
fmt.Fprintf(w, "Fatal Failure: %v\n", reason.(error)) //nolint: gas
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@ import (
|
|||
// HaltOnPanic recovers from panic, logs issue, sends upward notification, and exits
|
||||
func HaltOnPanic() {
|
||||
if r := recover(); r != nil {
|
||||
err := fmt.Errorf("%v: %v", ErrNodeRunFailure, r)
|
||||
strErr := fmt.Sprintf("%v: %v", ErrNodeRunFailure, r)
|
||||
|
||||
// send signal up to native app
|
||||
signal.Send(signal.Envelope{
|
||||
Type: signal.EventNodeCrashed,
|
||||
Event: signal.NodeCrashEvent{
|
||||
Error: err.Error(),
|
||||
Error: strErr,
|
||||
},
|
||||
})
|
||||
|
||||
common.Fatalf(err) // os.exit(1) is called internally
|
||||
common.Fatalf(ErrNodeRunFailure, r) // os.exit(1) is called internally
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue