Adding a MatchBytes() to match a glob pattern against a byte slice would be incredibly useful for searching within files.
For example:
package main
import "github.com/gobwas/glob"
func main() {
var g glob.Glob
g = glob.MustCompile("*.github.com")
g.MatchBytes([]byte("api.github.com")) // true
}
A further justification of this is how the regex package operates on bytes by default. I am not suggesting modifying the default behavior, though, but adding a MatchString() alias could help maintain compatibility if it ever becomes the default.
Adding a
MatchBytes()
to match a glob pattern against a byte slice would be incredibly useful for searching within files.For example:
A further justification of this is how the
regex
package operates on bytes by default. I am not suggesting modifying the default behavior, though, but adding aMatchString()
alias could help maintain compatibility if it ever becomes the default.