tartrazine/extension.go

21 lines
291 B
Go
Raw Normal View History

2016-07-13 17:05:09 +00:00
package slinguist
import (
"path/filepath"
)
func GetLanguageByExtension(filename string) (lang string, safe bool) {
lang = OtherLanguage
langs, ok := LanguagesByExtension[filepath.Ext(filename)]
if !ok {
return
}
lang = langs[0]
if len(langs) == 1 {
safe = true
}
return
}