Commit e531a778 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26242 from metral/refactor-get

Automatic merge from submit-queue fix recursive get for proper err display - refactor code to use `Infos()` instead - fixes https://github.com/kubernetes/kubernetes/issues/26241
parents 5643b749 950612eb
......@@ -219,15 +219,8 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
return err
}
infos := []*resource.Info{}
allErrs := []error{}
err = r.Visit(func(info *resource.Info, err error) error {
if err != nil {
return err
}
infos = append(infos, info)
return nil
})
infos, err := r.Infos()
if err != nil {
allErrs = append(allErrs, err)
}
......@@ -322,5 +315,5 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
continue
}
}
return utilerrors.NewAggregate(allErrs)
return utilerrors.Flatten(utilerrors.NewAggregate(allErrs))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment