MCPcopy
hub / github.com/spf13/viper / findConfigFileWithFinder

Method findConfigFileWithFinder

file.go:46–59  ·  view source on GitHub ↗
(finder Finder)

Source from the content-addressed store, hash-verified

44}
45
46func (v *Viper) findConfigFileWithFinder(finder Finder) (string, error) {
47 results, err := finder.Find(v.fs)
48 if err != nil {
49 return "", err
50 }
51
52 if len(results) == 0 {
53 return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
54 }
55
56 // We call clean on the final result to ensure that the path is in its canonical form.
57 // This is mostly for consistent path handling and to make sure tests pass.
58 return results[0], nil
59}
60
61// Search all configPaths for any config file.
62// Returns the first path that exists (and is a config file).

Callers 1

findConfigFileMethod · 0.95

Calls 1

FindMethod · 0.65

Tested by

no test coverage detected