Skip to content

Commit

Permalink
Fixing case sensitivity bug with override values
Browse files Browse the repository at this point in the history
  • Loading branch information
spf13 committed May 29, 2014
1 parent 16d5c7c commit 541c1f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ func SetDefault(key string, value interface{}) {
func Set(key string, value interface{}) {
// If alias passed in, then set the proper override
key = realKey(strings.ToLower(key))
key = strings.ToLower(key)
override[key] = value
}

Expand Down Expand Up @@ -392,6 +391,8 @@ func Debug() {
pretty.Println(defaults)
fmt.Println("Override:")
pretty.Println(override)
fmt.Println("Aliases:")
pretty.Println(aliases)
}

func Reset() {
Expand Down
4 changes: 4 additions & 0 deletions viper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ hobbies:
- skateboarding
- snowboarding
- go
clothing:
jacket: leather
trousers: denim
age: 35`)

var tomlExample = []byte(`
Expand Down Expand Up @@ -62,6 +65,7 @@ func TestMarshalling(t *testing.T) {
assert.False(t, InConfig("state"))
assert.Equal(t, "steve", Get("name"))
assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, Get("hobbies"))
assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, Get("clothing"))
assert.Equal(t, 35, Get("age"))
}

Expand Down

0 comments on commit 541c1f8

Please sign in to comment.