in walk.go [69:108]
func walkFull(oVal, rootVal reflect.Value, path llpath.Path, expandPaths bool, wo walkObserver) (err error) {
// Unpack any wrapped interfaces
for oVal.Kind() == reflect.Interface {
oVal = reflect.ValueOf(oVal.Interface())
}
lastPathComponent := path.Last()
if lastPathComponent == nil {
// In the case of a slice we can have an empty path
if oVal.Kind() == reflect.Slice || oVal.Kind() == reflect.Array {
lastPathComponent = &llpath.PathComponent{}
} else {
panic("Attempted to traverse an empty Path on non array/slice in lookslike.walkFull, this should never happen.")
}
}
err = wo(walkObserverInfo{*lastPathComponent, oVal, rootVal, path})
if err != nil {
return err
}
switch oVal.Kind() {
case reflect.Map:
err := walkFullMap(oVal, rootVal, path, expandPaths, wo)
if err != nil {
return err
}
case reflect.Slice:
for i := 0; i < oVal.Len(); i++ {
newPath := path.ExtendSlice(i)
err := walkFull(oVal.Index(i), rootVal, newPath, expandPaths, wo)
if err != nil {
return err
}
}
}
return nil
}