mirror of
https://github.com/spf13/viper
synced 2024-12-23 12:07:02 +00:00
Use the index as a fall back if the regular key is not found
This commit is contained in:
parent
7b841dc66d
commit
10c9322d34
1 changed files with 3 additions and 3 deletions
6
viper.go
6
viper.go
|
@ -329,10 +329,10 @@ func Get(key string) interface{} { return v.Get(key) }
|
||||||
func (v *Viper) Get(key string) interface{} {
|
func (v *Viper) Get(key string) interface{} {
|
||||||
key = strings.ToLower(key)
|
key = strings.ToLower(key)
|
||||||
var val interface{}
|
var val interface{}
|
||||||
v.buildIndex()
|
|
||||||
|
|
||||||
if val = v.findIndex(key); val == nil {
|
if val = v.find(key); val == nil {
|
||||||
val = v.find(key)
|
v.buildIndex()
|
||||||
|
val = v.findIndex(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
Loading…
Reference in a new issue