Add error handling

Added error handling around ineffectual err assignments. Please review
thoroughly.
This commit is contained in:
Christian Muehlhaeuser 2019-07-20 00:10:42 +02:00 committed by Márk Sági-Kazár
parent d65fa7608b
commit 1b33e8258e
2 changed files with 4 additions and 0 deletions

View file

@ -1469,6 +1469,9 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error {
case "hcl":
b, err := json.Marshal(c)
if err != nil {
return ConfigMarshalError{err}
}
ast, err := hcl.Parse(string(b))
if err != nil {
return ConfigMarshalError{err}

View file

@ -952,6 +952,7 @@ func TestDirsSearch(t *testing.T) {
v.SetDefault(`key`, `default`)
entries, err := ioutil.ReadDir(root)
assert.Nil(t, err)
for _, e := range entries {
if e.IsDir() {
v.AddConfigPath(e.Name())