From d3b6bc503a583bd2d841a9fba439b9f7e4056ff0 Mon Sep 17 00:00:00 2001 From: Tim Scheuermann Date: Fri, 11 Oct 2019 23:18:08 +0200 Subject: [PATCH] Call the os.UserHomeDir in Home --- utils/homedir.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/utils/homedir.go b/utils/homedir.go index 9a67a7b0..5a5d0fd2 100644 --- a/utils/homedir.go +++ b/utils/homedir.go @@ -6,7 +6,7 @@ package utils import ( "errors" - "os/user" + "os" "path/filepath" ) @@ -37,14 +37,5 @@ func ExpandHomeDir(path string) (string, error) { // Home returns the home directory for the executing user. // An error is returned if a home directory cannot be detected. func Home() (string, error) { - currentUser, err := user.Current() - if err != nil { - return "", err - } - - if currentUser.HomeDir == "" { - return "", errors.New("cannot find user-specific home dir") - } - - return currentUser.HomeDir, nil + return os.UserHomeDir() }