Files
go-task/internal/fingerprint/sources.go
Valentin Maerten ae3627c596 refactor: replace go-git with sabhiram/go-gitignore for lighter dependency
go-git pulled ~30 transitive dependencies and recursively walked the
entire worktree on every Globs() call. Replace with sabhiram/go-gitignore
(zero dependencies) and a simple walk from task dir up to rootDir to
collect .gitignore files. Pass rootDir (Taskfile ROOT_DIR) through the
checker chain to bound the search scope.
2026-06-07 15:02:55 +02:00

17 lines
422 B
Go

package fingerprint
import "fmt"
func NewSourcesChecker(method, tempDir string, dry bool, rootDir string) (SourcesCheckable, error) {
switch method {
case "timestamp":
return NewTimestampChecker(tempDir, dry, rootDir), nil
case "checksum":
return NewChecksumChecker(tempDir, dry, rootDir), nil
case "none":
return NoneChecker{}, nil
default:
return nil, fmt.Errorf(`task: invalid method "%s"`, method)
}
}