From 10c9322d34803aebc0f15550ad8425c54645029f Mon Sep 17 00:00:00 2001 From: Kiril Zvezdarov Date: Thu, 26 Mar 2015 17:51:40 -0400 Subject: [PATCH] Use the index as a fall back if the regular key is not found --- viper.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/viper.go b/viper.go index 8960d16..47c5ae7 100644 --- a/viper.go +++ b/viper.go @@ -329,10 +329,10 @@ func Get(key string) interface{} { return v.Get(key) } func (v *Viper) Get(key string) interface{} { key = strings.ToLower(key) var val interface{} - v.buildIndex() - if val = v.findIndex(key); val == nil { - val = v.find(key) + if val = v.find(key); val == nil { + v.buildIndex() + val = v.findIndex(key) } if val == nil {