From f187118258e5e8bf5cc20852c43484cc74f3caf1 Mon Sep 17 00:00:00 2001 From: Ariz Chang Date: Tue, 27 Feb 2024 16:57:19 -0800 Subject: [PATCH] instead of checking EACCES and EPERM, Go has a built in way to check this (Windows fix and is cross-platform) --- internal/resolver/resolver.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/resolver/resolver.go b/internal/resolver/resolver.go index 77dac02a311..6a817fdf5d6 100644 --- a/internal/resolver/resolver.go +++ b/internal/resolver/resolver.go @@ -3,6 +3,7 @@ package resolver import ( "errors" "fmt" + fs_real "io/fs" "path" "regexp" "sort" @@ -1460,7 +1461,7 @@ func (r resolverQuery) dirInfoUncached(path string) *dirInfo { // List the directories entries, err, originalError := r.fs.ReadDirectory(path) - if err == syscall.EACCES || err == syscall.EPERM { + if errors.Is(err, fs_real.ErrPermission) { // Just pretend this directory is empty if we can't access it. This is the // case on Unix for directories that only have the execute permission bit // set. It means we will just pass through the empty directory and