From 5ceafd556adcd8f900d3e254cc2e0f8fac1a0e48 Mon Sep 17 00:00:00 2001 From: Jordan Knott Date: Fri, 21 Aug 2020 23:29:08 -0500 Subject: [PATCH] fix: panic(nil) on loadConfig if config actually exists --- internal/commands/commands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/commands/commands.go b/internal/commands/commands.go index e1e1b32..dbdcd13 100644 --- a/internal/commands/commands.go +++ b/internal/commands/commands.go @@ -56,7 +56,10 @@ func initConfig() { viper.AutomaticEnv() err := viper.ReadInConfig() - if _, ok := err.(viper.ConfigFileNotFoundError); !ok { + if err == nil { + return + } + if _, ok := err.(viper.ConfigFileNotFoundError); !ok { panic(err) } }