diff --git a/cli/htmgo/internal/dirutil/glob.go b/cli/htmgo/internal/dirutil/glob.go index 3e015c2..1315c66 100644 --- a/cli/htmgo/internal/dirutil/glob.go +++ b/cli/htmgo/internal/dirutil/glob.go @@ -3,8 +3,6 @@ package dirutil import ( "fmt" "github.com/bmatcuk/doublestar/v4" - "io/fs" - "path/filepath" ) func matchesAny(patterns []string, path string) bool { @@ -31,20 +29,3 @@ func IsGlobMatch(path string, patterns []string, excludePatterns []string) bool } return matchesAny(patterns, path) } - -func GlobMatchDirs(root string, includePatterns, excludePatterns []string, cb func(string)) { - //directories := map[string]bool{} - // Walk through the directory recursively - _ = filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { - if err != nil { - return err - } - if matchesAny(excludePatterns, path) { - return fs.SkipDir - } - if matchesAny(includePatterns, path) { - cb(path) - } - return nil - }) -} diff --git a/framework/config/project.go b/framework/config/project.go index 688241d..72e222d 100644 --- a/framework/config/project.go +++ b/framework/config/project.go @@ -2,6 +2,7 @@ package config import ( "gopkg.in/yaml.v3" + "log/slog" "os" "path" ) @@ -45,9 +46,11 @@ func FromConfigFile(workingDir string) *ProjectConfig { bytes, err := os.ReadFile(filePath) if err == nil { err = yaml.Unmarshal(bytes, cfg) - if err == nil { - return cfg.EnhanceWithDefaults() + if err != nil { + slog.Error("Error parsing config file", slog.String("file", filePath), slog.String("error", err.Error())) + os.Exit(1) } + return cfg.EnhanceWithDefaults() } } }