<commit_before>package file

import (
	"os"
	"path/filepath"

	"github.com/arschles/gci/config/ci"
)

// WalkAndExclude walks the directory staring at root and returns all of the files (as relative paths) it finds, skipping all files and directories in exceptions
func WalkAndExclude(root string, excludes []ci.Exclude) ([]string, error) {
	var paths []string
	err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return nil
		}
		rel, err := filepath.Rel(root, path)
		if err != nil {
			return nil
		}
		if matchesExclude(rel, info, excludes) {
			if info.IsDir() {
				return filepath.SkipDir
			} else {
				return nil
			}
		}
		if info.IsDir() {
			return nil
		}
		paths = append(paths, path)
		return nil<commit_msg>go back to reporting errors in the walker<commit_after>package file

import (
	"os"
	"path/filepath"

	"github.com/arschles/gci/config/ci"
)

// WalkAndExclude walks the directory staring at root and returns all of the files (as relative paths) it finds, skipping all files and directories in exceptions
func WalkAndExclude(root string, excludes []ci.Exclude) ([]string, error) {
	var paths []string
	err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		rel, err := filepath.Rel(root, path)
		if err != nil {
			return nil
		}
		if matchesExclude(rel, info, excludes) {
			if info.IsDir() {
				return filepath.SkipDir
			} else {
				return nil
			}
		}
		if info.IsDir() {
			return nil
		}
		paths = append(paths, path)
		return nil
{'fraction_non_alphanumeric': 0.10786802030456853, 'fraction_numerical': 0.0, 'mean_word_length': 3.3805555555555555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1022865', 'n_tokens_mistral': 591, 'n_tokens_neox': 522, 'n_words': 174}