Use the index as a fall back if the regular key is not found

This commit is contained in:
Kiril Zvezdarov 2015-03-26 17:51:40 -04:00
parent 7b841dc66d
commit 10c9322d34

View file

@ -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 {