mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-12-05 00:00:34 +00:00
LanguagesByFilename: fix language order in generated code
Otherwise, generator tests are flaky test plan * make code-generate * go test -run '^TestGetLanguagesByFilename$' github.com/go-enry/go-enry/v2
This commit is contained in:
parent
bd3630419c
commit
dc1110e30c
@ -157,7 +157,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"Gemfile.lock": {"Gemfile.lock"},
|
||||
"Gopkg.lock": {"TOML"},
|
||||
"Guardfile": {"Ruby"},
|
||||
"HOSTS": {"INI", "Hosts File"},
|
||||
"HOSTS": {"Hosts File", "INI"},
|
||||
"INSTALL": {"Text"},
|
||||
"INSTALL.mysql": {"Text"},
|
||||
"JUSTFILE": {"Just"},
|
||||
@ -277,7 +277,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"gradlew": {"Shell"},
|
||||
"gvimrc": {"Vim Script"},
|
||||
"haproxy.cfg": {"HAProxy"},
|
||||
"hosts": {"INI", "Hosts File"},
|
||||
"hosts": {"Hosts File", "INI"},
|
||||
"httpd.conf": {"ApacheConf"},
|
||||
"initial_sids": {"SELinux Policy"},
|
||||
"inputrc": {"Readline Config"},
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
@ -91,7 +92,10 @@ func buildFilenameLanguageMap(languages map[string]*languageInfo) map[string][]s
|
||||
|
||||
func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string][]string, tmplPath, tmplName, commit string) error {
|
||||
fmap := template.FuncMap{
|
||||
"formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` },
|
||||
"formatStringSlice": func(slice []string) string {
|
||||
sort.Strings(slice)
|
||||
return `"` + strings.Join(slice, `","`) + `"`
|
||||
},
|
||||
}
|
||||
return executeTemplate(out, tmplName, tmplPath, commit, fmap, languagesByFilename)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user