From 274b25463a1d98834aab23ae98c678cf3be7325c Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 15 Sep 2024 14:37:34 +0200 Subject: [PATCH] tmp --- internal/log/log.go | 4 ++-- internalActions.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/log/log.go b/internal/log/log.go index 394b0bfd..f97142e8 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -2,7 +2,7 @@ package log import ( "fmt" - "io/ioutil" + "io" "log" "os" @@ -11,7 +11,7 @@ import ( "github.com/carapace-sh/carapace/pkg/ps" ) -var LOG = log.New(ioutil.Discard, "", log.Flags()) +var LOG = log.New(io.Discard, "", log.Flags()) func init() { if !env.Log() { diff --git a/internalActions.go b/internalActions.go index ef005165..03a38ff1 100644 --- a/internalActions.go +++ b/internalActions.go @@ -1,7 +1,6 @@ package carapace import ( - "io/ioutil" "net/url" "os" "path/filepath" @@ -35,7 +34,7 @@ func actionPath(fileSuffixes []string, dirOnly bool) Action { } actualFolder := filepath.ToSlash(filepath.Dir(abs)) - files, err := ioutil.ReadDir(actualFolder) + files, err := os.ReadDir(actualFolder) if err != nil { return ActionMessage(err.Error()) } @@ -48,7 +47,10 @@ func actionPath(fileSuffixes []string, dirOnly bool) Action { continue } - resolvedFile := file + resolvedFile, err := file.Info() + if err != nil { + return ActionMessage(err.Error()) + } if resolved, err := filepath.EvalSymlinks(actualFolder + file.Name()); err == nil { if stat, err := os.Stat(resolved); err == nil { resolvedFile = stat