func Glob(fsys fs.FS, pattern string) ([]string, error) {
	if !strings.Contains(pattern, "**") {
		// passthru to core package if no double-star
		return fs.Glob(fsys, pattern)
	}
	var matches []string
	regStr := strings.ReplaceAll(pattern, ".", "\\.")
	regStr = strings.ReplaceAll(regStr, "**", ".*")
	reg := regexp.MustCompile(regStr)
	err := fs.WalkDir(fsys, ".", func(path string, d fs.DirEntry, err error) error {
		if !d.IsDir() {
			if reg.MatchString(path) {
				matches = append(matches, path)
			}
		}
		return nil
	})
	return matches, err
}
// Glob adds double-star support to the core path/filepath Glob function.
// It's useful when your globs might have double-stars, but you're not sure.
Glob adds double-star support to the core path/filepath Glob function.
It's useful when your globs might have double-stars, but you're not sure.
// Glob adds double - star support to the core path / filepath Glob function . // It ' s useful when your globs might have double - stars but you ' re not sure .
func Glob(fsys fs.FS, pattern string) ([]string, error) {
	if !strings.Contains(pattern, "**") {
		return fs.Glob(fsys, pattern)
	}
	var matches []string
	regStr := strings.ReplaceAll(pattern, ".", "\\.")
	regStr = strings.ReplaceAll(regStr, "**", ".*")
	reg := regexp.MustCompile(regStr)
	err := fs.WalkDir(fsys, ".", func(path string, d fs.DirEntry, err error) error {
		if !d.IsDir() {
			if reg.MatchString(path) {
				matches = append(matches, path)
			}
		}
		return nil
	})
	return matches, err
}
func Glob ( fsys fs . FS , pattern string ) ( [ ] string , error ) { if ! strings . Contains ( pattern , " " ) { return fs . Glob ( fsys , pattern ) } var matches [ ] string regStr := strings . ReplaceAll ( pattern , " " , " \\ " ) regStr = strings . ReplaceAll ( regStr , " " , " " ) reg := regexp . MustCompile ( regStr ) err := fs . WalkDir ( fsys , " " , func ( path string , d fs . DirEntry , err error ) error { if ! d . IsDir ( ) { if reg . MatchString ( path ) { matches = append ( matches , path ) } } return nil } ) return matches , err }
Glob adds double-star support to the core path/filepath Glob function.
Glob adds double - star support to the core path / filepath Glob function .
// passthru to core package if no double-star