mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
Merge pull request #67 from mcarmonaa/fix/cli-optimization
check for extension and filename first, without load a file content
This commit is contained in:
commit
0582d61550
@ -61,6 +61,9 @@ func main() {
|
||||
return nil
|
||||
}
|
||||
|
||||
language, ok := enry.GetLanguageByExtension(path)
|
||||
if !ok {
|
||||
if language, ok = enry.GetLanguageByFilename(path); !ok {
|
||||
content, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
errors = true
|
||||
@ -68,10 +71,12 @@ func main() {
|
||||
return nil
|
||||
}
|
||||
|
||||
language := enry.GetLanguage(filepath.Base(path), content)
|
||||
language = enry.GetLanguage(filepath.Base(path), content)
|
||||
if language == enry.OtherLanguage {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out[language] = append(out[language], relativePath)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user