mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
21 lines
291 B
Go
21 lines
291 B
Go
|
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
|
||
|
}
|