// walk recursively descends path, calling w.

walk recursively descends path, calling w.
// walk recursively descends path calling w .
func walk(path string, info os.FileInfo, walkFn WalkFunc) error {
	err := walkFn(path, info, nil)
	if err != nil {
		if info.IsDir() && err == SkipDir {
			return nil
		}
		return err
	}
	if !info.IsDir() {
		return nil
	}
	names, err := readDirNames(path)
	if err != nil {
		return walkFn(path, info, err)
	}
	for _, name := range names {
		filename := filepath.Join(path, name)
		fileInfo, err := os.Lstat(filename)
		if err != nil {
			if err := walkFn(filename, fileInfo, err); err != nil && err != SkipDir {
				return err
			}
		} else {
			err = walk(filename, fileInfo, walkFn)
			if err != nil {
				if !fileInfo.IsDir() || err != SkipDir {
					return err
				}
			}
		}
	}
	return nil
}
func walk ( path string , info os . FileInfo , walkFn WalkFunc ) error { err := walkFn ( path , info , nil ) if err != nil { if info . IsDir ( ) && err == SkipDir { return nil } return err } if ! info . IsDir ( ) { return nil } names , err := readDirNames ( path ) if err != nil { return walkFn ( path , info , err ) } for _ , name := range names { filename := filepath . Join ( path , name ) fileInfo , err := os . Lstat ( filename ) if err != nil { if err := walkFn ( filename , fileInfo , err ) ; err != nil && err != SkipDir { return err } } else { err = walk ( filename , fileInfo , walkFn ) if err != nil { if ! fileInfo . IsDir ( ) || err != SkipDir { return err } } } } return nil }
walk recursively descends path, calling w.
walk recursively descends path calling w .