From 86d102494b60a5988c174fc2932466bb164c4128 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 20 Feb 2026 14:49:02 -0800 Subject: [PATCH] Remove unused functions (#36672) Follow #36643 --- modules/setting/config_provider.go | 17 ----------------- modules/setting/config_provider_test.go | 18 ------------------ 2 files changed, 35 deletions(-) diff --git a/modules/setting/config_provider.go b/modules/setting/config_provider.go index 57dc23b17f7..a734f3bf8f5 100644 --- a/modules/setting/config_provider.go +++ b/modules/setting/config_provider.go @@ -348,23 +348,6 @@ func deprecatedSettingDB(rootCfg ConfigProvider, oldSection, oldKey string) { } } -// NewConfigProviderForLocale loads locale configuration from source and others. "string" if for a local file path, "[]byte" is for INI content -func NewConfigProviderForLocale(source any, others ...any) (ConfigProvider, error) { - iniFile, err := ini.LoadSources(ini.LoadOptions{ - IgnoreInlineComment: true, - UnescapeValueCommentSymbols: true, - IgnoreContinuation: true, - }, source, others...) - if err != nil { - return nil, fmt.Errorf("unable to load locale ini: %w", err) - } - iniFile.BlockMode = false - return &iniConfigProvider{ - ini: iniFile, - loadedFromEmpty: true, - }, nil -} - func init() { ini.PrettyFormat = false } diff --git a/modules/setting/config_provider_test.go b/modules/setting/config_provider_test.go index 63121f00740..dcbe280e824 100644 --- a/modules/setting/config_provider_test.go +++ b/modules/setting/config_provider_test.go @@ -113,24 +113,6 @@ func TestNewConfigProviderFromFile(t *testing.T) { assert.Equal(t, "[foo]\nk1 = a\n\n[bar]\nk1 = b\n", string(bs)) } -func TestNewConfigProviderForLocale(t *testing.T) { - // load locale from file - localeFile := t.TempDir() + "/locale.ini" - _ = os.WriteFile(localeFile, []byte(`k1=a`), 0o644) - cfg, err := NewConfigProviderForLocale(localeFile) - assert.NoError(t, err) - assert.Equal(t, "a", cfg.Section("").Key("k1").String()) - - // load locale from bytes - cfg, err = NewConfigProviderForLocale([]byte("k1=foo\nk2=bar")) - assert.NoError(t, err) - assert.Equal(t, "foo", cfg.Section("").Key("k1").String()) - cfg, err = NewConfigProviderForLocale([]byte("k1=foo\nk2=bar"), []byte("k2=xxx")) - assert.NoError(t, err) - assert.Equal(t, "foo", cfg.Section("").Key("k1").String()) - assert.Equal(t, "xxx", cfg.Section("").Key("k2").String()) -} - func TestDisableSaving(t *testing.T) { testFile := t.TempDir() + "/test.ini" _ = os.WriteFile(testFile, []byte("k1=a\nk2=b"), 0o644)