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.
If I do something like
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 astring
that I pass-intoMustCompile
-- this loses compile-time type-checking.