diff options
Diffstat (limited to 'internal/linguist')
-rw-r--r-- | internal/linguist/linguist.go | 8 | ||||
-rw-r--r-- | internal/linguist/linguist_test.go | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/internal/linguist/linguist.go b/internal/linguist/linguist.go index 8ce217e4c..3b215fd9a 100644 --- a/internal/linguist/linguist.go +++ b/internal/linguist/linguist.go @@ -57,8 +57,8 @@ func Color(language string) string { } // LoadColors loads the name->color map from the Linguist gem. -func LoadColors() error { - jsonReader, err := openLanguagesJSON() +func LoadColors(cfg config.Cfg) error { + jsonReader, err := openLanguagesJSON(cfg) if err != nil { return err } @@ -67,8 +67,8 @@ func LoadColors() error { return json.NewDecoder(jsonReader).Decode(&colorMap) } -func openLanguagesJSON() (io.ReadCloser, error) { - if jsonPath := config.Config.Ruby.LinguistLanguagesPath; jsonPath != "" { +func openLanguagesJSON(cfg config.Cfg) (io.ReadCloser, error) { + if jsonPath := cfg.Ruby.LinguistLanguagesPath; jsonPath != "" { // This is a fallback for environments where dynamic discovery of the // linguist path via Bundler is not working for some reason, for example // https://gitlab.com/gitlab-org/gitaly/issues/1119. diff --git a/internal/linguist/linguist_test.go b/internal/linguist/linguist_test.go index 8522c6f45..93c3e8b2b 100644 --- a/internal/linguist/linguist_test.go +++ b/internal/linguist/linguist_test.go @@ -11,7 +11,7 @@ import ( func TestLoadLanguages(t *testing.T) { colorMap = make(map[string]Language) - require.NoError(t, LoadColors(), "load colors") + require.NoError(t, LoadColors(config.Config), "load colors") require.Equal(t, "#701516", Color("Ruby"), "color value for 'Ruby'") } @@ -23,7 +23,7 @@ func TestLoadLanguagesCustomPath(t *testing.T) { config.Config.Ruby.LinguistLanguagesPath = jsonPath colorMap = make(map[string]Language) - require.NoError(t, LoadColors(), "load colors") + require.NoError(t, LoadColors(config.Config), "load colors") require.Equal(t, "foo color", Color("FooBar")) } |