func (c Copyright) includeOrExclude(root, path string, info os.FileInfo) error {
	if info.IsDir() {
		if path == root {
			return ErrWalkSkip
		}
	}

	if c.Config.Excludes != nil {
		for _, exclude := range c.Config.Excludes {
			if stringutil.Glob(path, exclude) {
				c.Debugf("path %s matches exclude %s", path, exclude)
				if info.IsDir() {
					return filepath.SkipDir
				}
				return ErrWalkSkip
			}
		}
	}

	if c.Config.IncludeFiles != nil {
		var includePath bool
		for _, include := range c.Config.IncludeFiles {
			if stringutil.Glob(path, include) {
				includePath = true
				break
			}
		}
		if !includePath {
			c.Debugf("path %s does not match any includes", path)
			return ErrWalkSkip
		}
	}

	if info.IsDir() {
		return ErrWalkSkip
	}

	return nil
}
// includeOrExclude makes the determination if we should process a path (file or directory).
includeOrExclude makes the determination if we should process a path (file or directory).
// includeOrExclude makes the determination if we should process a path ( file or directory ) .
func (c Copyright) includeOrExclude(root, path string, info os.FileInfo) error {
	if info.IsDir() {
		if path == root {
			return ErrWalkSkip
		}
	}
	if c.Config.Excludes != nil {
		for _, exclude := range c.Config.Excludes {
			if stringutil.Glob(path, exclude) {
				c.Debugf("path %s matches exclude %s", path, exclude)
				if info.IsDir() {
					return filepath.SkipDir
				}
				return ErrWalkSkip
			}
		}
	}
	if c.Config.IncludeFiles != nil {
		var includePath bool
		for _, include := range c.Config.IncludeFiles {
			if stringutil.Glob(path, include) {
				includePath = true
				break
			}
		}
		if !includePath {
			c.Debugf("path %s does not match any includes", path)
			return ErrWalkSkip
		}
	}
	if info.IsDir() {
		return ErrWalkSkip
	}
	return nil
}
func ( c Copyright ) includeOrExclude ( root , path string , info os . FileInfo ) error { if info . IsDir ( ) { if path == root { return ErrWalkSkip } } if c . Config . Excludes != nil { for _ , exclude := range c . Config . Excludes { if stringutil . Glob ( path , exclude ) { c . Debugf ( " " , path , exclude ) if info . IsDir ( ) { return filepath . SkipDir } return ErrWalkSkip } } } if c . Config . IncludeFiles != nil { var includePath bool for _ , include := range c . Config . IncludeFiles { if stringutil . Glob ( path , include ) { includePath = true break } } if ! includePath { c . Debugf ( " " , path ) return ErrWalkSkip } } if info . IsDir ( ) { return ErrWalkSkip } return nil }
includeOrExclude makes the determination if we should process a path (file or directory).
includeOrExclude makes the determination if we should process a path ( file or directory ) .