Path returns the config file path
(paths []string)
| 7 | |
| 8 | // Path returns the config file path |
| 9 | func Path(paths []string) (string, error) { |
| 10 | |
| 11 | // check if the config file exists on any paths |
| 12 | for _, p := range paths { |
| 13 | if _, err := os.Stat(p); err == nil { |
| 14 | return p, nil |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | // we can't find the config file if we make it this far |
| 19 | return "", fmt.Errorf("could not locate config file") |
| 20 | } |
no outgoing calls