celestiaorg / celestiaorg/celestia-node
nodebuilder: Explore why `mergo` does not preserve custom values for top-level field for the field that it is changing
- Dominant language
- Go
- Stars
- 996
- Forks
- 1.1k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 34
Description
> There is one unfortunate caveat which is that if a newly added field is merged into the old config, some old custom values from that field may be overwritten which is why I included a prompt to the user to ensure their old custom values were preserved. Custom values from other fields that were unchanged in the config are preserved however.
Related to implementation inside of #2068
For example:
```
[Share]
PeersLimit = 5
DiscoveryInterval = "30s"
AdvertiseInterval = "30s"
UseShareExchange = true
[Share.ShrExEDSParams]
ServerReadTimeout = "5s"
ServerWriteTimeout = "1m0s"
HandleRequestTimeout = "1m0s"
ConcurrencyLimit = 10
BufferSize = 32768
[Share.ShrExNDParams]
ServerReadTimeout = "5s"
ServerWriteTimeout = "1m0s"
HandleRequestTimeout = "1m0s"
ConcurrencyLimit = 10
[Share.PeerManagerParams]
PoolValidationTimeout = "2m0s"
PeerCooldown = "3s"
GcInterval = "30s"
EnableBlackListing = false
```
After I did `config-update`, it merged in the default `Share.PeerManagerParams` config but it also overwrote my custom values at the top-level `Share` config.
We should fix this so that all custom values are preserved.
Contributor guide
Assessment
This issue has not been assessed yet.