mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 22:53:05 -03:00
code from domain
This commit is contained in:
20
extension.go
Normal file
20
extension.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user