Fixed #68
diff --git a/viper.go b/viper.go
index f2c09ce..84878d5 100644
--- a/viper.go
+++ b/viper.go
@@ -738,22 +738,19 @@
v.config = make(map[string]interface{})
- v.marshalReader(bytes.NewReader(file), v.config)
- return nil
+ return v.marshalReader(bytes.NewReader(file), v.config)
}
func ReadConfig(in io.Reader) error { return v.ReadConfig(in) }
func (v *Viper) ReadConfig(in io.Reader) error {
v.config = make(map[string]interface{})
- v.marshalReader(in, v.config)
- return nil
+ return v.marshalReader(in, v.config)
}
// func ReadBufConfig(buf *bytes.Buffer) error { return v.ReadBufConfig(buf) }
// func (v *Viper) ReadBufConfig(buf *bytes.Buffer) error {
// v.config = make(map[string]interface{})
-// v.marshalReader(buf, v.config)
-// return nil
+// return v.marshalReader(buf, v.config)
// }
// Attempts to get configuration from a remote source
@@ -778,9 +775,12 @@
// Marshall a Reader into a map
// Should probably be an unexported function
-func marshalReader(in io.Reader, c map[string]interface{}) { v.marshalReader(in, c) }
-func (v *Viper) marshalReader(in io.Reader, c map[string]interface{}) {
- marshallConfigReader(in, c, v.getConfigType())
+func marshalReader(in io.Reader, c map[string]interface{}) error {
+ return v.marshalReader(in, c)
+}
+
+func (v *Viper) marshalReader(in io.Reader, c map[string]interface{}) error {
+ return marshallConfigReader(in, c, v.getConfigType())
}
func (v *Viper) insensitiviseMaps() {
@@ -813,7 +813,7 @@
if err != nil {
return nil, err
}
- v.marshalReader(reader, v.kvstore)
+ err = v.marshalReader(reader, v.kvstore)
return v.kvstore, err
}
@@ -835,7 +835,7 @@
if err != nil {
return nil, err
}
- v.marshalReader(reader, v.kvstore)
+ err = v.marshalReader(reader, v.kvstore)
return v.kvstore, err
}