| 348 | } |
| 349 | |
| 350 | func fieldByIndexSafe(val reflect.Value, path []int) (reflect.Value, bool) { |
| 351 | current := val |
| 352 | for _, idx := range path { |
| 353 | for current.Kind() == reflect.Pointer { |
| 354 | if current.IsNil() { |
| 355 | return reflect.Value{}, false |
| 356 | } |
| 357 | current = current.Elem() |
| 358 | } |
| 359 | if current.Kind() != reflect.Struct { |
| 360 | return reflect.Value{}, false |
| 361 | } |
| 362 | current = current.Field(idx) |
| 363 | } |
| 364 | return current, true |
| 365 | } |
| 366 | |
| 367 | func embeddedStructType(t reflect.Type) (reflect.Type, bool) { |
| 368 | for t.Kind() == reflect.Pointer { |