From 7a279af43de6650d2f36c41f9d926db7be3b3567 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Thu, 26 Sep 2019 22:12:24 +0000 Subject: [PATCH] config: revert to using pkg/homedir In c2626a82 homedir logic got extremely simplified to only checking HOME environment variable on UNIX systems. Although this should work well enough in traditional environments, this could break minimal containerized environments. This patch reverts to using github.com/docker/docker/pkg/homedir that was recently updated to have less dependencies. Signed-off-by: Tibor Vass --- cli/config/config.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/config/config.go b/cli/config/config.go index 09810782c3..c860cf7125 100644 --- a/cli/config/config.go +++ b/cli/config/config.go @@ -10,6 +10,7 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/credentials" "github.com/docker/cli/cli/config/types" + "github.com/docker/docker/pkg/homedir" "github.com/pkg/errors" ) @@ -27,10 +28,7 @@ var ( func init() { if configDir == "" { - homedir, err := os.UserHomeDir() - if err == nil { - configDir = filepath.Join(homedir, configFileDir) - } + configDir = filepath.Join(homedir.Get(), configFileDir) } }