From e23f8896392847fa83a4d193c6af517fb5ef198d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 12 Sep 2018 21:35:27 -0700 Subject: [PATCH] config: return an error if unable to parse values in the config file --- config.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index ec1159bb..431488f6 100644 --- a/config.go +++ b/config.go @@ -345,7 +345,14 @@ func loadConfig() (*config, error) { var configFileError error cfg := preCfg if err := flags.IniParse(configFilePath, &cfg); err != nil { - configFileError = err + // If it's a parsing related error, then we'll return + // immediately, otherwise we can proceed as possibly the config + // file doesn't exist which is OK. + if _, ok := err.(*flags.IniError); ok { + return nil, err + } else { + configFileError = err + } } // Finally, parse the remaining command line options again to ensure