// Walk calls walkFn for each file within the given archive file.
// The archive format is chosen implicitly.
545305
func Walk(archive string, walkFn WalkFunc) error {
	wIface, err := ByExtension(archive)
	if err != nil {
		return err
	}
	w, ok := wIface.(Walker)
	if !ok {
		return fmt.Errorf("format specified by archive filename is not a walker format: %s (%T)", archive, wIface)
	}
	return w.Walk(archive, walkFn)
}
411095
func (s ErrCountFS) Walk(ctx context.Context, path string, fn WalkFn) error {
	return s.fs.Walk(ctx, path, fn)
}
446906
func Walk(root string) <-chan WalkItem {
	// probably more efficient since wait only when chan is full
	iterChannel := make(chan WalkItem, chanBuffSize)
	dirsAlreadyProcessed := make(map[string]bool)
	dirsToProcess := []string{root}
	go func() {
		for len(dirsToProcess) > 0 {
			dirs, files := []os.FileInfo{}, []os.FileInfo{}
			dirpath := NormalizePath(dirsToProcess[len(dirsToProcess)-1])
			dirsToProcess = dirsToProcess[:len(dirsToProcess)-1]
			if _, ok := dirsAlreadyProcessed[dirpath]; !ok {
				dirsAlreadyProcessed[dirpath] = true
				filesInfo, err := ioutil.ReadDir(NormalizePath(dirpath))
				if err != nil {
					log.Errorf("Error reading directory (%s): %s\n", err.Error(), dirpath)
				} else {
					for _, fileInfo := range filesInfo {
						switch {
						case fileInfo.Mode().IsDir():
							dirs = append(dirs, fileInfo)
							dirsToProcess = append(dirsToProcess, filepath.Join(dirpath, fileInfo.Name()))
						case fileInfo.Mode().IsRegular():
							files = append(files, fileInfo)
						case fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink:
							var pointerFI os.FileInfo
							sympath := NormalizePath(filepath.Join(dirpath, fileInfo.Name()))
							pointerFI, err = os.Stat(sympath)
							if err != nil {
								log.Errorf("Error reading symlink (%s): %s\n", err.Error(), sympath)
							} else {
								switch {
								case pointerFI.Mode().IsDir():
									dirs = append(dirs, fileInfo)
									dirsToProcess = append(dirsToProcess, sympath)
								case pointerFI.Mode().IsRegular():
									files = append(files, fileInfo)
								}
							}
						}
					}
				}
				iterChannel <- WalkItem{dirpath, dirs, files, err}
			}
		}
		close(iterChannel)
	}()
	return iterChannel
}
851259
func (b *Box) Walk(path string, walkFn filepath.WalkFunc) error {

	pathFile, err := b.Open(path)
	if err != nil {
		return err
	}
	defer pathFile.Close()

	pathInfo, err := pathFile.Stat()
	if err != nil {
		return err
	}

	if b.IsAppended() || b.IsEmbedded() {
		return b.walk(path, pathInfo, walkFn)
	}

	// We don't have any embedded or appended box so use live filesystem mode
	return filepath.Walk(filepath.Join(b.absolutePath, path), func(path string, info os.FileInfo, err error) error {

		// Strip out the box name from the returned paths
		path = strings.TrimPrefix(path, b.absolutePath+string(os.PathSeparator))
		return walkFn(path, info, err)

	})

}
126806
func (t *Tombstoner) Walk(fn func(t Tombstone) error) error {
	t.mu.Lock()
	defer t.mu.Unlock()

	f, err := os.Open(t.tombstonePath())
	if os.IsNotExist(err) {
		return nil
	} else if err != nil {
		return err
	}
	defer f.Close()

	var b [4]byte
	if _, err := f.Read(b[:]); err != nil {
		return errors.New("unable to read header")
	}

	if _, err := f.Seek(0, io.SeekStart); err != nil {
		return err
	}

	header := binary.BigEndian.Uint32(b[:])
	if header == v4header {
		return t.readTombstoneV4(f, fn)
	}
	return errors.New("invalid tombstone file")
}
1093897
func (z *Zip) Walk(archive string, walkFn WalkFunc) error {
	zr, err := zip.OpenReader(archive)
	if err != nil {
		return fmt.Errorf("opening zip reader: %v", err)
	}
	defer zr.Close()

	for _, zf := range zr.File {
		zfrc, err := zf.Open()
		if err != nil {
			zfrc.Close()
			if z.ContinueOnError {
				log.Printf("[ERROR] Opening %s: %v", zf.Name, err)
				continue
			}
			return fmt.Errorf("opening %s: %v", zf.Name, err)
		}

		err = walkFn(File{
			FileInfo:   zf.FileInfo(),
			Header:     zf.FileHeader,
			ReadCloser: zfrc,
		})
		zfrc.Close()
		if err != nil {
			if err == ErrStopWalk {
				break
			}
			if z.ContinueOnError {
				log.Printf("[ERROR] Walking %s: %v", zf.Name, err)
				continue
			}
			return fmt.Errorf("walking %s: %v", zf.Name, err)
		}
	}

	return nil
}
154846
func (f *FakeFP) Walk(root string, walkFunc filepath.WalkFunc) error {
	f.WalkInvoked = true
	return walkFunc(root, NewFakeFI(), nil)
}
778865
func (c *Client) Walk(root string) *fs.Walker {
	return fs.WalkFS(root, c)
}
248404
func (m *Module) Walk(f func(*Module) error) error {
	visited := make(map[string]struct{})

	toVisit := make([]*Module, 0, 100)
	toVisit = append(toVisit, m)

	for len(toVisit) > 0 {
		m := toVisit[0]
		toVisit = toVisit[1:]

		if _, ok := visited[m.ThriftPath]; ok {
			continue
		}

		visited[m.ThriftPath] = struct{}{}
		for _, inc := range m.Includes {
			toVisit = append(toVisit, inc.Module)
		}

		if err := f(m); err != nil {
			return err
		}
	}

	return nil
}
189227
func Walk(ctx context.Context, root string, fs FileSystem) *Walker {
	info, err := fs.Lstat(ctx, root)
	return &Walker{
		fs:    fs,
		ctx:   ctx,
		stack: []item{{root, info, err}},
	}
}
555778
func (t Tree) Walk(f func(*exphtml.Node)) {
	WalkNodes(t.n, f)
}
537196
func (t *watcherTree) walk(fn walkFn) {
	t.Tree.Walk(func(prefix string, val interface{}) bool {
		watchers := val.([]*BufferWatcher)
		for _, w := range watchers {
			fn(w)
		}
		return false
	})
}
923999
func (j *JSONPath) walk(value []reflect.Value, node Node) ([]reflect.Value, error) {
	switch node := node.(type) {
	case *ListNode:
		return j.evalList(value, node)
	case *TextNode:
		return []reflect.Value{reflect.ValueOf(node.Text)}, nil
	case *FieldNode:
		return j.evalField(value, node)
	case *ArrayNode:
		return j.evalArray(value, node)
	case *FilterNode:
		return j.evalFilter(value, node)
	case *IntNode:
		return j.evalInt(value, node)
	case *BoolNode:
		return j.evalBool(value, node)
	case *FloatNode:
		return j.evalFloat(value, node)
	case *WildcardNode:
		return j.evalWildcard(value, node)
	case *RecursiveNode:
		return j.evalRecursive(value, node)
	case *UnionNode:
		return j.evalUnion(value, node)
	case *IdentifierNode:
		return j.evalIdentifier(value, node)
	default:
		return value, fmt.Errorf("unexpected Node %v", node)
	}
}
671240
func (n *AltElse) Walk(v walker.Visitor) {
	if v.EnterNode(n) == false {
		return
	}

	if n.Stmt != nil {
		v.EnterChildNode("Stmt", n)
		n.Stmt.Walk(v)
		v.LeaveChildNode("Stmt", n)
	}

	v.LeaveNode(n)
}
1268770
func (tsz *TarSz) Walk(archive string, walkFn WalkFunc) error {
	tsz.wrapReader()
	return tsz.Tar.Walk(archive, walkFn)
}
1276666
func (txz *TarXz) Walk(archive string, walkFn WalkFunc) error {
	txz.wrapReader()
	return txz.Tar.Walk(archive, walkFn)
}
118753
func (c *cachedFS) Walk(ctx context.Context, path string, fn WalkFn) error {
	return c.src.Walk(ctx, path, fn)
}