Skip to content

Commit

Permalink
fix: properly return error from config.Init
Browse files Browse the repository at this point in the history
Checking for file-not-exist error is not enough.

Fixes #683

Signed-off-by: Dmitriy Matrenichev <[email protected]>
  • Loading branch information
DmitriyMV committed Oct 14, 2024
1 parent 3655206 commit 190b591
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/pkg/omnictl/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ var (
func Init(path string, create bool) (*Config, error) {
conf, err := load(path)

if os.IsNotExist(err) {
switch {
case os.IsNotExist(err):
if !create {
return nil, err
}
Expand All @@ -55,6 +56,8 @@ func Init(path string, create bool) (*Config, error) {
}

conf = &defaultConfig
case err != nil:
return nil, err
}

current = conf
Expand Down

0 comments on commit 190b591

Please sign in to comment.