Skip to content

Commit 86d1024

Browse files
authored
Remove unused functions (#36672)
Follow #36643
1 parent bcd253a commit 86d1024

2 files changed

Lines changed: 0 additions & 35 deletions

File tree

modules/setting/config_provider.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,23 +348,6 @@ func deprecatedSettingDB(rootCfg ConfigProvider, oldSection, oldKey string) {
348348
}
349349
}
350350

351-
// NewConfigProviderForLocale loads locale configuration from source and others. "string" if for a local file path, "[]byte" is for INI content
352-
func NewConfigProviderForLocale(source any, others ...any) (ConfigProvider, error) {
353-
iniFile, err := ini.LoadSources(ini.LoadOptions{
354-
IgnoreInlineComment: true,
355-
UnescapeValueCommentSymbols: true,
356-
IgnoreContinuation: true,
357-
}, source, others...)
358-
if err != nil {
359-
return nil, fmt.Errorf("unable to load locale ini: %w", err)
360-
}
361-
iniFile.BlockMode = false
362-
return &iniConfigProvider{
363-
ini: iniFile,
364-
loadedFromEmpty: true,
365-
}, nil
366-
}
367-
368351
func init() {
369352
ini.PrettyFormat = false
370353
}

modules/setting/config_provider_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,6 @@ func TestNewConfigProviderFromFile(t *testing.T) {
113113
assert.Equal(t, "[foo]\nk1 = a\n\n[bar]\nk1 = b\n", string(bs))
114114
}
115115

116-
func TestNewConfigProviderForLocale(t *testing.T) {
117-
// load locale from file
118-
localeFile := t.TempDir() + "/locale.ini"
119-
_ = os.WriteFile(localeFile, []byte(`k1=a`), 0o644)
120-
cfg, err := NewConfigProviderForLocale(localeFile)
121-
assert.NoError(t, err)
122-
assert.Equal(t, "a", cfg.Section("").Key("k1").String())
123-
124-
// load locale from bytes
125-
cfg, err = NewConfigProviderForLocale([]byte("k1=foo\nk2=bar"))
126-
assert.NoError(t, err)
127-
assert.Equal(t, "foo", cfg.Section("").Key("k1").String())
128-
cfg, err = NewConfigProviderForLocale([]byte("k1=foo\nk2=bar"), []byte("k2=xxx"))
129-
assert.NoError(t, err)
130-
assert.Equal(t, "foo", cfg.Section("").Key("k1").String())
131-
assert.Equal(t, "xxx", cfg.Section("").Key("k2").String())
132-
}
133-
134116
func TestDisableSaving(t *testing.T) {
135117
testFile := t.TempDir() + "/test.ini"
136118
_ = os.WriteFile(testFile, []byte("k1=a\nk2=b"), 0o644)

0 commit comments

Comments
 (0)