modules: Add config option modules.vendorClosest

Fixes #8235
Fixes #8242
This commit is contained in:
Bjørn Erik Pedersen
2021-02-14 19:24:13 +01:00
parent b60e9279ab
commit bdfbcf6f4b
5 changed files with 64 additions and 9 deletions

View File

@@ -33,6 +33,14 @@ var (
globMu sync.RWMutex
)
type caseInsensitiveGlob struct {
g glob.Glob
}
func (g caseInsensitiveGlob) Match(s string) bool {
return g.g.Match(strings.ToLower(s))
}
func GetGlob(pattern string) (glob.Glob, error) {
var eg globErr
@@ -46,7 +54,7 @@ func GetGlob(pattern string) (glob.Glob, error) {
var err error
g, err := glob.Compile(strings.ToLower(pattern), '/')
eg = globErr{g, err}
eg = globErr{caseInsensitiveGlob{g: g}, err}
globMu.Lock()
globCache[pattern] = eg