config: keep configDir empty when homedir errors

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2019-09-24 23:48:59 +00:00
parent 0397c2ca01
commit 47f059db7a
1 changed files with 2 additions and 3 deletions

View File

@ -28,12 +28,11 @@ var (
func init() { func init() {
if configDir == "" { if configDir == "" {
homedir, err := os.UserHomeDir() homedir, err := os.UserHomeDir()
if err != nil { if err == nil {
panic(err)
}
configDir = filepath.Join(homedir, configFileDir) configDir = filepath.Join(homedir, configFileDir)
} }
} }
}
// Dir returns the directory the configuration file is stored in // Dir returns the directory the configuration file is stored in
func Dir() string { func Dir() string {