Esempio n. 1
// Visit implements the Visitor interface on the items described in the Builder.
// Note that some visitor sources are not traversable more than once, or may
// return different results.  If you wish to operate on the same set of resources
// multiple times, use the Infos() method.
func (r *Result) Visit(fn VisitorFunc) error {
	if r.err != nil {
		return r.err
	err := r.visitor.Visit(fn)
	return errors.FilterOut(err, r.ignoreErrors...)
Esempio n. 2
// Infos returns an array of all of the resource infos retrieved via traversal.
// Will attempt to traverse the entire set of visitors only once, and will return
// a cached list on subsequent calls.
func (r *Result) Infos() ([]*Info, error) {
	if r.err != nil {
		return nil, r.err
	if != nil {
		return, nil

	infos := []*Info{}
	err := r.visitor.Visit(func(info *Info) error {
		infos = append(infos, info)
		return nil
	err = errors.FilterOut(err, r.ignoreErrors...), r.err = infos, err
	return infos, err