Exemple #1
0
func walk(path string, d *os.Dir, v Visitor, errors chan<- os.Error) {
	if !d.IsDirectory() {
		v.VisitFile(path, d)
		return
	}

	if !v.VisitDir(path, d) {
		return // skip directory entries
	}

	list, err := io.ReadDir(path)
	if err != nil {
		if errors != nil {
			errors <- err
		}
	}

	for _, e := range list {
		walk(Join(path, e.Name), e, v, errors)
	}
}
Exemple #2
0
func isPkgDir(dir *os.Dir) bool {
	return dir.IsDirectory() && len(dir.Name) > 0 && dir.Name[0] != '_'
}