From e36d5487c9e57764c53d66d8306f13903fdb80a6 Mon Sep 17 00:00:00 2001 From: Matt Gowie Date: Tue, 13 Sep 2022 13:33:43 -0400 Subject: [PATCH] fix: updates file_utils#FileExists to check for err (#191) (#195) * fix: updates file_utils#FileExists to check for err (#191) * chore: adds `atmos.yaml` to error message Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> Co-authored-by: Andriy Knysh Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- pkg/config/config.go | 2 +- pkg/utils/file_utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 859582410..38387bdfe 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -361,7 +361,7 @@ func ProcessConfigForSpacelift() error { // https://medium.com/@bnprashanth256/reading-configuration-files-and-environment-variables-in-go-golang-c2607f912b63 func processConfigFile(path string, v *viper.Viper) error { if !u.FileExists(path) { - u.PrintInfoVerbose(fmt.Sprintf("No CLI config found in '%s'", path)) + u.PrintInfoVerbose(fmt.Sprintf("No config file atmos.yaml found in path '%s'.", path)) return nil } diff --git a/pkg/utils/file_utils.go b/pkg/utils/file_utils.go index 978d30d2e..81e00fc75 100644 --- a/pkg/utils/file_utils.go +++ b/pkg/utils/file_utils.go @@ -19,7 +19,7 @@ func IsDirectory(path string) (bool, error) { // FileExists checks if a file exists and is not a directory func FileExists(filename string) bool { fileInfo, err := os.Stat(filename) - if os.IsNotExist(err) { + if os.IsNotExist(err) || err != nil { return false } return !fileInfo.IsDir()