mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
Do not return empty lang.
It's better to return any potential candidate than nothing. Signed-off-by: kuba-- <kuba@sourced.tech>
This commit is contained in:
@ -41,11 +41,12 @@ func GetLanguage(filename string, content []byte) (language string) {
|
||||
}
|
||||
|
||||
func firstLanguage(languages []string) string {
|
||||
if len(languages) == 0 {
|
||||
return OtherLanguage
|
||||
for _, l := range languages {
|
||||
if l != "" {
|
||||
return l
|
||||
}
|
||||
}
|
||||
|
||||
return languages[0]
|
||||
return OtherLanguage
|
||||
}
|
||||
|
||||
// GetLanguageByModeline returns detected language. If there are more than one possibles languages
|
||||
|
Reference in New Issue
Block a user