Skip to content

Commit 807f763

Browse files
committed
Refactor code
1 parent 23484cf commit 807f763

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

config.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,15 @@ func BindEnvs(conf interface{}, parts ...string) error {
123123
}
124124
switch v.Kind() {
125125
case reflect.Struct:
126-
return BindEnvs(v.Interface(), append(parts, tv)...)
126+
err := BindEnvs(v.Interface(), append(parts, tv)...)
127+
if err != nil {
128+
return err
129+
}
127130
default:
128-
return viper.BindEnv(strings.Join(append(parts, tv), "."))
131+
err := viper.BindEnv(strings.Join(append(parts, tv), "."))
132+
if err != nil {
133+
return err
134+
}
129135
}
130136
}
131137
return nil

0 commit comments

Comments
 (0)