You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
516 B
Go

package gopher
import (
"gophi/core"
"regexp"
)
var (
// gophermapRegex is the precompiled gophermap file name regex check
gophermapRegex *regexp.Regexp
)
// compileGophermapRegex compiles the gophermap file name check regex
func compileGophermapRegex() *regexp.Regexp {
return regexp.MustCompile(`^(|.+/|.+\.)gophermap$`)
}
// isGophermap checks against gophermap regex as to whether a file path is a gophermap
func isGophermap(path *core.Path) bool {
return gophermapRegex.MatchString(path.Relative())
}