diff --git a/pkg/internal/common/print.go b/pkg/internal/common/print.go index a24b832..a022d9f 100644 --- a/pkg/internal/common/print.go +++ b/pkg/internal/common/print.go @@ -7,6 +7,18 @@ import ( func PrettyPrintStruct(data interface{}) { v := reflect.ValueOf(data) + + // If it's a pointer, get the underlying element + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + + // Check if it's a struct + if v.Kind() != reflect.Struct { + fmt.Println("Not a struct or pointer to struct") + return + } + typeOfS := v.Type() for i := 0; i < v.NumField(); i++ {