gobwas / glob

Go glob
MIT License
957 stars 64 forks source link

Allow access to source text in returned `glob.Glob` type #39

Open ekinanp opened 4 years ago

ekinanp commented 4 years ago

If I do something like

g := glob.MustCompile("foo")

then I should be able to get the source text "foo" via something like g.SourceText().

Use-case: I have functions that expect a glob. It'd be nice to get compile-time type-checking by restricting those functions to accept a glob.Glob type. However, some of those functions need the source text, so I cannot currently do that. Instead, I have those functions take a string that I pass-into MustCompile -- this loses compile-time type-checking.