mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
fixed GetLanguageByContent returned value when there is not a function matcher for the extension
This commit is contained in:
parent
28dc452853
commit
664afe48d4
@ -14,10 +14,11 @@ func GetLanguageByContent(filename string, content []byte) (lang string, safe bo
|
||||
ext := strings.ToLower(filepath.Ext(filename))
|
||||
if fnMatcher, ok := matchers[ext]; ok {
|
||||
lang, safe = fnMatcher(content)
|
||||
return
|
||||
} else {
|
||||
lang = OtherLanguage
|
||||
}
|
||||
|
||||
return GetLanguageByExtension(filename)
|
||||
return
|
||||
}
|
||||
|
||||
type languageMatcher func([]byte) (string, bool)
|
||||
|
@ -14,10 +14,11 @@ func GetLanguageByContent(filename string, content []byte) (lang string, safe bo
|
||||
ext := strings.ToLower(filepath.Ext(filename))
|
||||
if fnMatcher, ok := matchers[ext]; ok {
|
||||
lang, safe = fnMatcher(content)
|
||||
return
|
||||
} else {
|
||||
lang = OtherLanguage
|
||||
}
|
||||
|
||||
return GetLanguageByExtension(filename)
|
||||
return
|
||||
}
|
||||
|
||||
type languageMatcher func ([]byte) (string, bool)
|
||||
|
@ -14,10 +14,11 @@ func GetLanguageByContent(filename string, content []byte) (lang string, safe bo
|
||||
ext := strings.ToLower(filepath.Ext(filename))
|
||||
if fnMatcher, ok := matchers[ext]; ok {
|
||||
lang, safe = fnMatcher(content)
|
||||
return
|
||||
} else {
|
||||
lang = OtherLanguage
|
||||
}
|
||||
|
||||
return GetLanguageByExtension(filename)
|
||||
return
|
||||
}
|
||||
|
||||
type languageMatcher func([]byte) (string, bool)
|
||||
|
Loading…
Reference in New Issue
Block a user