Fixed unmarshalReader not returning error when the input io.Reader returns an error

This commit is contained in:
Thulio Assis 2018-10-19 13:47:18 -07:00
parent 62edee3196
commit 8f88ea76a6
No known key found for this signature in database
GPG Key ID: 7484A94EF9712178
1 changed files with 3 additions and 1 deletions

View File

@ -1329,7 +1329,9 @@ func unmarshalReader(in io.Reader, c map[string]interface{}) error {
} }
func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error { func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(in) if _, err := buf.ReadFrom(in); err != nil {
return ConfigParseError{err}
}
switch strings.ToLower(v.getConfigType()) { switch strings.ToLower(v.getConfigType()) {
case "yaml", "yml": case "yaml", "yml":