From 62cca62432123abb914317d20eab845ae995ef29 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Thu, 27 Jun 2019 09:38:00 -0500 Subject: [PATCH] Log error on failure to read config file - include actual error to highlight the specific issue --- cmd/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 69890a9d..de2eee24 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -138,8 +138,8 @@ func initConfig() { log.Printf("Using config file: %s\n\n", viper.ConfigFileUsed()) } else { invalidConfigError := "Couldn't read config file" - fmt.Println("Error: ", invalidConfigError) - log.Fatal(invalidConfigError) + formattedError := fmt.Sprintf("%s: %s", invalidConfigError, err.Error()) + log.Fatal(formattedError) } }