golint: FNM_FOOBAR -> fnmatch.FooBar

This commit is contained in:
Jakob Borg
2015-04-04 22:03:03 +02:00
parent b08ee3ff81
commit 6e317896e9
3 changed files with 22 additions and 22 deletions
+10 -10
View File
@@ -14,9 +14,9 @@ import (
)
const (
FNM_NOESCAPE = (1 << iota)
FNM_PATHNAME
FNM_CASEFOLD
NoEscape = (1 << iota)
PathName
CaseFold
)
func Convert(pattern string, flags int) (*regexp.Regexp, error) {
@@ -24,16 +24,16 @@ func Convert(pattern string, flags int) (*regexp.Regexp, error) {
switch runtime.GOOS {
case "windows":
flags |= FNM_NOESCAPE | FNM_CASEFOLD
flags |= NoEscape | CaseFold
pattern = filepath.FromSlash(pattern)
if flags&FNM_PATHNAME != 0 {
if flags&PathName != 0 {
any = "[^\\\\]"
}
case "darwin":
flags |= FNM_CASEFOLD
flags |= CaseFold
fallthrough
default:
if flags&FNM_PATHNAME != 0 {
if flags&PathName != 0 {
any = "[^/]"
}
}
@@ -41,11 +41,11 @@ func Convert(pattern string, flags int) (*regexp.Regexp, error) {
// Support case insensitive ignores
ignore := strings.TrimPrefix(pattern, "(?i)")
if ignore != pattern {
flags |= FNM_CASEFOLD
flags |= CaseFold
pattern = ignore
}
if flags&FNM_NOESCAPE != 0 {
if flags&NoEscape != 0 {
pattern = strings.Replace(pattern, "\\", "\\\\", -1)
} else {
pattern = strings.Replace(pattern, "\\*", "[:escapedstar:]", -1)
@@ -69,7 +69,7 @@ func Convert(pattern string, flags int) (*regexp.Regexp, error) {
pattern = strings.Replace(pattern, "[:escapeddot:]", "\\.", -1)
pattern = "^" + pattern + "$"
if flags&FNM_CASEFOLD != 0 {
if flags&CaseFold != 0 {
pattern = "(?i)" + pattern
}
return regexp.Compile(pattern)