Be certain to clear our marshalled representation before reloading it
This commit is contained in:
parent
a941739f8a
commit
9db12374ea
1 changed files with 4 additions and 0 deletions
|
@ -199,6 +199,10 @@ func (d *Datastore) get() *Metadata {
|
||||||
func (d *Datastore) Load() (Object, error) {
|
func (d *Datastore) Load() (Object, error) {
|
||||||
d.localLock.Lock()
|
d.localLock.Lock()
|
||||||
defer d.localLock.Unlock()
|
defer d.localLock.Unlock()
|
||||||
|
|
||||||
|
// clear Object first, as mapstructure's decoder doesn't have ZeroFields set to true for merging purposes
|
||||||
|
d.meta.Object = d.meta.Object[:0]
|
||||||
|
|
||||||
err := d.kv.LoadConfig(d.meta)
|
err := d.kv.LoadConfig(d.meta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue