fix merge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
ab6b82304a
commit
afab7aa1d6
6
env.go
6
env.go
@ -37,15 +37,15 @@ func (c *envConfig) Load(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst, err := config.Zero(c.opts.Struct)
|
src, err := config.Zero(c.opts.Struct)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = c.fillValues(ctx, reflect.ValueOf(dst))
|
err = c.fillValues(ctx, reflect.ValueOf(src))
|
||||||
}
|
}
|
||||||
if err != nil && !c.opts.AllowFail {
|
if err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = mergo.Merge(c.opts.Struct, dst, mergo.WithOverride, mergo.WithTypeCheck, mergo.WithAppendSlice); err != nil && !c.opts.AllowFail {
|
if err = mergo.Merge(c.opts.Struct, src, mergo.WithOverride, mergo.WithTypeCheck, mergo.WithAppendSlice); err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user