From 91ad43e727b57a0a619944a43615d053253b6cd5 Mon Sep 17 00:00:00 2001 From: Prajjawalk Date: Sun, 20 Aug 2023 12:46:04 +0530 Subject: [PATCH] Handle error in viper.WriteConfigAs function --- runtime/configs/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/configs/config.go b/runtime/configs/config.go index a9ff77645..c40d3c891 100644 --- a/runtime/configs/config.go +++ b/runtime/configs/config.go @@ -253,7 +253,10 @@ func SaveConfig(path string) { } NewDefaultConfig() - viper.WriteConfigAs(filePath) + err = viper.WriteConfigAs(filePath) + if err != nil { + log.Fatalf("[ERROR] failed to write config to file, error: %s", err.Error()) + } fmt.Printf("save_default_config: saved default config at %v", filePath) }