From 494f30a1a518d80e2b4f4200615859429dcd7245 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 12 Jun 2020 22:12:29 +0200 Subject: [PATCH] config: fix error message using incorrect filename Before: echo 'invalid-json' > ~/.dockercfg docker pull hello-world WARNING: Error loading config file: /root/.docker/config.json: Invalid Auth config file After: echo 'invalid-json' > ~/.dockercfg docker pull hello-world WARNING: Error loading config file: /root/.dockercfg: Invalid Auth config file Signed-off-by: Sebastiaan van Stijn --- cli/config/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/config/config.go b/cli/config/config.go index b81626664a..9dbc08f88f 100644 --- a/cli/config/config.go +++ b/cli/config/config.go @@ -117,11 +117,11 @@ func Load(configDir string) (*configfile.ConfigFile, error) { if err != nil { return configFile, errors.Wrap(err, oldConfigfile) } - confFile := filepath.Join(homedir, oldConfigfile) - if _, err := os.Stat(confFile); err != nil { + filename = filepath.Join(homedir, oldConfigfile) + if _, err := os.Stat(filename); err != nil { return configFile, nil // missing file is not an error } - file, err := os.Open(confFile) + file, err := os.Open(filename) if err != nil { return configFile, errors.Wrap(err, filename) }