code from domain

This commit is contained in:
Máximo Cuadros
2016-07-13 19:05:09 +02:00
commit 6bc52531e7
7 changed files with 1524 additions and 0 deletions

20
extension.go Normal file
View File

@ -0,0 +1,20 @@
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
}