mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +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"},
|
"Gemfile.lock": {"Gemfile.lock"},
|
||||||
"Gopkg.lock": {"TOML"},
|
"Gopkg.lock": {"TOML"},
|
||||||
"Guardfile": {"Ruby"},
|
"Guardfile": {"Ruby"},
|
||||||
"HOSTS": {"INI", "Hosts File"},
|
"HOSTS": {"Hosts File", "INI"},
|
||||||
"INSTALL": {"Text"},
|
"INSTALL": {"Text"},
|
||||||
"INSTALL.mysql": {"Text"},
|
"INSTALL.mysql": {"Text"},
|
||||||
"JUSTFILE": {"Just"},
|
"JUSTFILE": {"Just"},
|
||||||
@ -277,7 +277,7 @@ var LanguagesByFilename = map[string][]string{
|
|||||||
"gradlew": {"Shell"},
|
"gradlew": {"Shell"},
|
||||||
"gvimrc": {"Vim Script"},
|
"gvimrc": {"Vim Script"},
|
||||||
"haproxy.cfg": {"HAProxy"},
|
"haproxy.cfg": {"HAProxy"},
|
||||||
"hosts": {"INI", "Hosts File"},
|
"hosts": {"Hosts File", "INI"},
|
||||||
"httpd.conf": {"ApacheConf"},
|
"httpd.conf": {"ApacheConf"},
|
||||||
"initial_sids": {"SELinux Policy"},
|
"initial_sids": {"SELinux Policy"},
|
||||||
"inputrc": {"Readline Config"},
|
"inputrc": {"Readline Config"},
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"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 {
|
func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string][]string, tmplPath, tmplName, commit string) error {
|
||||||
fmap := template.FuncMap{
|
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)
|
return executeTemplate(out, tmplName, tmplPath, commit, fmap, languagesByFilename)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user