From 92da209c983992743052a98562eb2d5198195a05 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 31 Mar 2023 21:08:46 +0800 Subject: [PATCH] fix: use os.UserHomeDir (#1706) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- act/runner/run_context.go | 3 +-- cmd/notices.go | 3 +-- cmd/root.go | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/act/runner/run_context.go b/act/runner/run_context.go index 27bbe878..7883a0f1 100644 --- a/act/runner/run_context.go +++ b/act/runner/run_context.go @@ -17,7 +17,6 @@ import ( "runtime" "strings" - "github.com/mitchellh/go-homedir" "github.com/opencontainers/selinux/go-selinux" log "github.com/sirupsen/logrus" @@ -359,7 +358,7 @@ func (rc *RunContext) ActionCacheDir() string { var xdgCache string var ok bool if xdgCache, ok = os.LookupEnv("XDG_CACHE_HOME"); !ok || xdgCache == "" { - if home, err := homedir.Dir(); err == nil { + if home, err := os.UserHomeDir(); err == nil { xdgCache = filepath.Join(home, ".cache") } else if xdgCache, err = filepath.Abs("."); err != nil { log.Fatal(err) diff --git a/cmd/notices.go b/cmd/notices.go index bd03aa3e..9ddcf6fa 100644 --- a/cmd/notices.go +++ b/cmd/notices.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/mitchellh/go-homedir" log "github.com/sirupsen/logrus" ) @@ -136,7 +135,7 @@ func etagPath() string { var xdgCache string var ok bool if xdgCache, ok = os.LookupEnv("XDG_CACHE_HOME"); !ok || xdgCache == "" { - if home, err := homedir.Dir(); err == nil { + if home, err := os.UserHomeDir(); err == nil { xdgCache = filepath.Join(home, ".cache") } else if xdgCache, err = filepath.Abs("."); err != nil { log.Fatal(err) diff --git a/cmd/root.go b/cmd/root.go index 9983a4b6..fc3e43e1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,7 +15,6 @@ import ( "github.com/adrg/xdg" "github.com/andreaskoch/go-fswatch" "github.com/joho/godotenv" - "github.com/mitchellh/go-homedir" gitignore "github.com/sabhiram/go-gitignore" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -95,7 +94,7 @@ func Execute(ctx context.Context, version string) { } func configLocations() []string { - home, err := homedir.Dir() + home, err := os.UserHomeDir() if err != nil { log.Fatal(err) }