MCPcopy Create free account
hub / github.com/github/gh-aw / fieldByIndexSafe

Function fieldByIndexSafe

pkg/console/render.go:350–365  ·  view source on GitHub ↗
(val reflect.Value, path []int)

Source from the content-addressed store, hash-verified

348}
349
350func 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
367func embeddedStructType(t reflect.Type) (reflect.Type, bool) {
368 for t.Kind() == reflect.Pointer {

Callers 1

buildTableRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected