mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-04-27 19:47:31 +00:00
* Remove `logger` module * Remove `shared` module * Move `cli` folder contents into project root * Fix linter * Change the module name from `github.com/kubeshark/kubeshark/cli` to `github.com/kubeshark/kubeshark` * Set the default `Makefile` rule to `build` * Add `lint` rule * Fix the linter errors
26 lines
574 B
Go
26 lines
574 B
Go
package goUtils
|
|
|
|
import (
|
|
"log"
|
|
"reflect"
|
|
"runtime/debug"
|
|
)
|
|
|
|
func HandleExcWrapper(fn interface{}, params ...interface{}) (result []reflect.Value) {
|
|
defer func() {
|
|
if panicMessage := recover(); panicMessage != nil {
|
|
stack := debug.Stack()
|
|
log.Fatalf("Unhandled panic: %v\n stack: %s", panicMessage, stack)
|
|
}
|
|
}()
|
|
f := reflect.ValueOf(fn)
|
|
if f.Type().NumIn() != len(params) {
|
|
panic("incorrect number of parameters!")
|
|
}
|
|
inputs := make([]reflect.Value, len(params))
|
|
for k, in := range params {
|
|
inputs[k] = reflect.ValueOf(in)
|
|
}
|
|
return f.Call(inputs)
|
|
}
|