Proper interface value obtaining and more tests.

This commit is contained in:
2019-09-18 14:53:58 +05:00
parent e34e443897
commit 448edf8970
2 changed files with 34 additions and 3 deletions

View File

@@ -25,9 +25,13 @@ func composeTree(value reflect.Value, prefix string) {
// If currently processed field - interface, then we should
// get underlying value.
//if fieldToProcess.Kind() == reflect.Interface {
// fieldToProcess = fieldToProcess.Elem()
//}
if fieldToProcess.Kind() == reflect.Interface {
if fieldToProcess.Elem().Kind() == reflect.Ptr {
fieldToProcess = fieldToProcess.Elem().Elem()
} else if fieldToProcess.Elem().Kind() == reflect.Struct {
fieldToProcess = fieldToProcess.Elem()
}
}
// In 99% of cases we will get uninitialized things we should
// initialize.