Documentation
¶
Overview ¶
Package filterlist implements the --files-from JSON include/exclude filter for ckg build. Supplied at the CLI as a path to a JSON file:
{
"include": ["internal/**/*.go", "cmd/ckg/*.go"],
"exclude": ["**/testdata/**", "**/*_test.go"]
}
Patterns use Go's filepath.Match doublestar extension via the bundled matcher: `**` matches any number of path segments. Both fields are optional — empty include means "every discovered file is eligible" and the exclude list still trims unwanted matches.
Rationale: ckg already has heuristic discovery (detect.Walk for TS/Sol, go/packages.Load for Go) and a .ckgignore for project-wide excludes. --files-from is the explicit operator override for "I have my own build list — use exactly these files." This is the entry point for future build-system integration (tsconfig include/exclude, hardhat sources, `go list -f '{{.GoFiles}}'`) which all produce a file list as output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterList ¶
FilterList holds the parsed include/exclude rules.
func Load ¶
func Load(path string) (*FilterList, error)
Load reads and parses the JSON file at path. Returns a nil filter (and nil error) when path is empty — callers can treat nil as "no filter".
func (*FilterList) Allow ¶
func (f *FilterList) Allow(relPath string) bool
Allow reports whether relPath (slash-separated, relative to srcRoot) passes the filter. Decision rule:
- exclude match → reject (exclude trumps include)
- include empty → accept
- include match → accept
- otherwise → reject
func (*FilterList) FilterPaths ¶
func (f *FilterList) FilterPaths(paths []string) []string
FilterPaths returns the subset of paths that f.Allow accepts. nil filter returns paths unchanged (zero allocation).