From d2d9418b8b7b8e9821ce911cc0d1d826b6d728d7 Mon Sep 17 00:00:00 2001 From: Seednode Date: Wed, 13 Sep 2023 12:46:14 -0500 Subject: [PATCH] Replace user.Home() with os.HomeDir() to remove CGo dependency (hopefully) --- cmd/files.go | 7 +++---- cmd/root.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 4d09bf7..c88f4b8 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "math/big" - "os/user" "regexp" "crypto/rand" @@ -604,15 +603,15 @@ func pickFile(args []string, filters *filters, sort string, cache *fileCache, fo } func normalizePath(path string) (string, error) { - usr, err := user.Current() + homeDir, err := os.UserHomeDir() if err != nil { return "", err } if path == "~" { - path = usr.HomeDir + path = homeDir } else if strings.HasPrefix(path, "~/") { - path = filepath.Join(usr.HomeDir, path[2:]) + path = filepath.Join(homeDir, path[2:]) } path, err = filepath.EvalSymlinks(path) diff --git a/cmd/root.go b/cmd/root.go index 650f2fa..b4c4117 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "0.78.1" + ReleaseVersion string = "0.78.2" ) var (