Skip to content

Commit

Permalink
fix: updates file_utils#FileExists to check for err (#191) (#195)
Browse files Browse the repository at this point in the history
* fix: updates file_utils#FileExists to check for err (#191)

* chore: adds `atmos.yaml` to error message

Co-authored-by: nitrocode <[email protected]>

Co-authored-by: Andriy Knysh <[email protected]>
Co-authored-by: nitrocode <[email protected]>
  • Loading branch information
3 people authored Sep 13, 2022
1 parent c7e5f64 commit e36d548
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/file_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e36d548

Please sign in to comment.