From 20fa59eaad567abf863c3f9cd736db81a6dfa4a3 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Wed, 17 Aug 2022 11:03:15 -0400 Subject: [PATCH] allow multiple deprecation warnings --- cmd/tendermint/commands/root.go | 7 ++++--- config/config.go | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/tendermint/commands/root.go b/cmd/tendermint/commands/root.go index e4061bc28..16ea8a391 100644 --- a/cmd/tendermint/commands/root.go +++ b/cmd/tendermint/commands/root.go @@ -53,9 +53,10 @@ func ParseConfig(cmd *cobra.Command) (*cfg.Config, error) { if err := conf.ValidateBasic(); err != nil { return nil, fmt.Errorf("error in config file: %v", err) } - err = conf.CheckDeprecated() - if err != nil { - logger.Info("deprecated usage found in configuration file", "error", err) + if warnings := conf.CheckDeprecated(); len(warnings) > 0 { + for _, warning := range warnings { + logger.Info("deprecated usage found in configuration file", "usage", warning) + } } return conf, nil } diff --git a/config/config.go b/config/config.go index f6bc1dc87..6cb12835d 100644 --- a/config/config.go +++ b/config/config.go @@ -151,14 +151,15 @@ func (cfg *Config) ValidateBasic() error { return nil } -func (cfg *Config) CheckDeprecated() error { +func (cfg *Config) CheckDeprecated() []string { + var warnings []string if cfg.DeprecatedFastSyncConfig != nil { - return errors.New("[fastsync] table detected. This section has been renamed to [blocksync]. The values in this deprecated section will be disregarded.") + warnings = append(warnings, "[fastsync] table detected. This section has been renamed to [blocksync]. The values in this deprecated section will be disregarded.") } if cfg.BaseConfig.DeprecatedFastSyncMode != nil { - return errors.New("fast_sync key detected. This key has been renamed to block_sync. The value of this deprecated key will be disregarded.") + warnings = append(warnings, "fast_sync key detected. This key has been renamed to block_sync. The value of this deprecated key will be disregarded.") } - return nil + return warnings } //-----------------------------------------------------------------------------