diff --git a/file_content.go b/file_content.go index 5870d7a..a5c6f6e 100644 --- a/file_content.go +++ b/file_content.go @@ -14,7 +14,7 @@ func GetEncounteredLangs() []Language { func hasExpectedLanguage(file string, expectedExt []string) bool { for _, ext := range expectedExt { - if strings.HasSuffix(file, ext) { + if strings.HasSuffix(file, ext) || isDockerfile(file) { return true } } diff --git a/help.go b/help.go index 00b0a30..aeda91d 100644 --- a/help.go +++ b/help.go @@ -22,6 +22,10 @@ func GetAllLanguagesInDir(root string) []Language { ext := fileExtensionFromPath(path) langName := lookupLangByExtension(ext) lang := Languages[langName] + if isDockerfile(path) && ext == "." { + langName = "Dockerfile" + lang = Languages[langName] + } if len(lang.Name) != 0 && !alreadyInserted[lang.Name] { availableLangs = append(availableLangs, lang) alreadyInserted[lang.Name] = true @@ -102,6 +106,8 @@ func randomInt(min, max int) int { return min + rand.Intn(max-min) } +func isDockerfile(file string) bool { return strings.HasSuffix(file, "Dockerfile") } + func fileExtensionFromPath(path string) string { return "." + strings.TrimPrefix(filepath.Ext(path), ".") }