From 0dc4bb19c63a29a44eecf709e7b90a1396f3318f Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Sun, 12 Jan 2020 11:41:09 +0000 Subject: [PATCH] First check for config type then for file without extension --- viper.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/viper.go b/viper.go index 3b78f03..265eae7 100644 --- a/viper.go +++ b/viper.go @@ -1976,8 +1976,10 @@ func (v *Viper) searchInPath(in string) (filename string) { } } - if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b && v.configType != "" { - return filepath.Join(in, v.configName) + if v.configType != "" { + if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b { + return filepath.Join(in, v.configName) + } } return ""