MCPcopy Create free account
hub / github.com/unknwon/goconfig / LoadConfigFile

Function LoadConfigFile

read.go:219–236  ·  view source on GitHub ↗

LoadConfigFile reads a file and returns a new configuration representation. This representation can be queried with GetValue.

(fileName string, moreFiles ...string)

Source from the content-addressed store, hash-verified

217// LoadConfigFile reads a file and returns a new configuration representation.
218// This representation can be queried with GetValue.
219func LoadConfigFile(fileName string, moreFiles ...string) (c *ConfigFile, err error) {
220 // Append files' name together.
221 fileNames := make([]string, 1, len(moreFiles)+1)
222 fileNames[0] = fileName
223 if len(moreFiles) > 0 {
224 fileNames = append(fileNames, moreFiles...)
225 }
226
227 c = newConfigFile(fileNames)
228
229 for _, name := range fileNames {
230 if err = c.loadFile(name); err != nil {
231 return nil, err
232 }
233 }
234
235 return c, nil
236}
237
238// Reload reloads configuration file in case it has changes.
239func (c *ConfigFile) Reload() (err error) {

Callers 13

TestLoadConfigFileFunction · 0.85
TestGetKeyListFunction · 0.85
TestSaveConfigFileFunction · 0.85
TestSaveConfigDataFunction · 0.85
TestReloadFunction · 0.85
TestAppendFilesFunction · 0.85
TestTypesFunction · 0.85
TestMustFunction · 0.85
TestRangeFunction · 0.85
TestArrayFunction · 0.85
Benchmark_GetValueFunction · 0.85
Benchmark_SetValueFunction · 0.85

Calls 2

newConfigFileFunction · 0.85
loadFileMethod · 0.80

Tested by 12

TestLoadConfigFileFunction · 0.68
TestGetKeyListFunction · 0.68
TestSaveConfigFileFunction · 0.68
TestSaveConfigDataFunction · 0.68
TestReloadFunction · 0.68
TestAppendFilesFunction · 0.68
TestTypesFunction · 0.68
TestMustFunction · 0.68
TestRangeFunction · 0.68
TestArrayFunction · 0.68
Benchmark_GetValueFunction · 0.68
Benchmark_SetValueFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…