diff --git a/cmd/statusd/main.go b/cmd/statusd/main.go index 50feceb43..addec1824 100644 --- a/cmd/statusd/main.go +++ b/cmd/statusd/main.go @@ -250,7 +250,7 @@ Examples: Options: ` - fmt.Fprintf(os.Stderr, usage) // nolint: gas + fmt.Fprint(os.Stderr, usage) // nolint: gas flag.PrintDefaults() } diff --git a/geth/common/utils.go b/geth/common/utils.go index b81bd3455..fd4be38f6 100644 --- a/geth/common/utils.go +++ b/geth/common/utils.go @@ -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 } diff --git a/geth/node/utils.go b/geth/node/utils.go index ec4b2db67..aadc4e388 100644 --- a/geth/node/utils.go +++ b/geth/node/utils.go @@ -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 } }