"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hugofs/glob/glob.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

glob.go  (hugo-0.80.0):glob.go  (hugo-0.81.0)
skipping to change at line 36 skipping to change at line 36
type globErr struct { type globErr struct {
glob glob.Glob glob glob.Glob
err error err error
} }
var ( var (
globCache = make(map[string]globErr) globCache = make(map[string]globErr)
globMu sync.RWMutex 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) { func GetGlob(pattern string) (glob.Glob, error) {
var eg globErr var eg globErr
globMu.RLock() globMu.RLock()
var found bool var found bool
eg, found = globCache[pattern] eg, found = globCache[pattern]
globMu.RUnlock() globMu.RUnlock()
if found { if found {
return eg.glob, eg.err return eg.glob, eg.err
} }
var err error var err error
g, err := glob.Compile(strings.ToLower(pattern), '/') g, err := glob.Compile(strings.ToLower(pattern), '/')
eg = globErr{g, err} eg = globErr{caseInsensitiveGlob{g: g}, err}
globMu.Lock() globMu.Lock()
globCache[pattern] = eg globCache[pattern] = eg
globMu.Unlock() globMu.Unlock()
return eg.glob, eg.err return eg.glob, eg.err
} }
func NormalizePath(p string) string { func NormalizePath(p string) string {
return strings.Trim(path.Clean(filepath.ToSlash(strings.ToLower(p))), "/. ") return strings.Trim(path.Clean(filepath.ToSlash(strings.ToLower(p))), "/. ")
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)