Skip to content

Commit 3839c45

Browse files
committed
Better commentaries, removed a useless func
1 parent 3d3bd55 commit 3839c45

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

common.go

+3-7
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func GetLanguageByClassifier(content []byte, candidates []string) (language stri
8888
return getLanguageByStrategy(GetLanguagesByClassifier, "", content, candidates)
8989
}
9090

91-
// GetLanguageByGitattributes returns the language assigned for a given regular expresion in .gitattributes.
91+
// GetLanguageByGitattributes returns the language assigned to a file for a given regular expresion in .gitattributes.
9292
// This strategy needs to be initialized calling LoadGitattributes
9393
func GetLanguageByGitattributes(filename string) (language string, safe bool) {
9494
return getLanguageByStrategy(GetLanguagesByGitattributes, filename, nil, nil)
@@ -442,13 +442,9 @@ func GetLanguageByAlias(alias string) (lang string, ok bool) {
442442
return
443443
}
444444

445-
// GetLanguagesByGitattributes returns the language assigned in .gitattributes if the regular expresion
446-
// matchs with the filename
445+
// GetLanguagesByGitattributes returns a length 1 slice with the language assigned in .gitattributes if the regular expresion
446+
// matchs with the filename. It is comply with the signature to be a Strategy type.
447447
func GetLanguagesByGitattributes(filename string, content []byte, candidates []string) []string {
448-
return languageByGitattribute(filename)
449-
}
450-
451-
func languageByGitattribute(filename string) []string {
452448
languages := []string{}
453449
for regExp, language := range languageGitattributes {
454450
if regExp.MatchString(filename) {

0 commit comments

Comments
 (0)