Golang globs and the Double Star Glob Operator
The golang filepath/glob and filepath/match functions provide glob matching but does not support the "double star", "double asterisk", "globstar", "super glob", "super wildcard" operation that descends into other directories. According to Issue 11862 the problem seems to be handling edge cases like crossing file system boundaries, symlinks and infinite loops (if I read @rsc's comment correctly).
In the meantime, one of these packages might work:
- mattn/go-zglob looks very optimized for filewalking
- bmatcuk/doublestar appears to be the most mature
- godo/glob.go is an implementation embedded inside godo
In addition gobwas/glob is an excellent generic glob package that claims huge performance advantages over other globs and the equivalent regular expressions. It does not however provide a filewalker.
Happy globbing, and if you want to know more about the science of globs, @rsc wrote it up for you.