mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
This pull request introduces a new glob pattern matching utility to the `gfile` package, adding support for advanced glob patterns including the "**" (globstar) operator, which matches across directory boundaries, similar to bash and gitignore. It also includes a comprehensive set of unit tests to verify the correctness and cross-platform compatibility of the new functionality. **Glob pattern matching feature:** * Added `MatchGlob` function to `gfile`, which extends `filepath.Match` with support for the "**" (globstar) pattern, enabling recursive directory matching and more flexible file pattern matching. * Implemented internal helpers (`matchGlobstar` and `doMatchGlobstar`) to handle normalization of path separators and recursive matching logic for patterns containing "**". **Testing and validation:** * Added `gfile_z_unit_match_test.go` with extensive unit tests covering basic glob patterns, globstar usage, prefix/suffix combinations, multiple globstars, edge cases, and Windows path compatibility to ensure robust and cross-platform behavior. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com>