Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jul 15, 2019
1 parent 7a48846 commit 3cea6e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,6 @@ func (v *Viper) Get(key string) interface{} {
// Sub is case-insensitive for a key.
func Sub(key string) *Viper { return v.Sub(key) }
func (v *Viper) Sub(key string) *Viper {
v.lock.Lock()
defer v.lock.Unlock()

subv := New()
data := v.Get(key)
if data == nil {
Expand Down
10 changes: 7 additions & 3 deletions viper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1751,9 +1751,13 @@ func TestWatchFile(t *testing.T) {
}

func TestArrayOfObjects(t *testing.T) {
SetConfigFile("./stub/config.yaml")
require.NoError(t, ReadInConfig())
SetConfigFile("./stub/config.json")
SetConfigType("yml")
require.NoError(t, ReadConfig(bytes.NewBufferString(`foo:
bar:
- baz: 1
- baz: 2`)))

SetConfigFile(path.Join(os.TempDir(), fmt.Sprintf("config-%d.json", time.Now().UnixNano())))
require.NoError(t, WriteConfig())
}

Expand Down

0 comments on commit 3cea6e6

Please sign in to comment.