From 41e670c9ba6ec026c4c00b8267e6950eb0cb494f Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Fri, 7 Jun 2024 16:33:03 +0300 Subject: [PATCH] [#1167] adm/morph: Move literal to const Signed-off-by: Alexander Chuprov --- cmd/frostfs-adm/internal/modules/morph/config/config.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/config/config.go b/cmd/frostfs-adm/internal/modules/morph/config/config.go index bfcd4ac0..ba6e515c 100644 --- a/cmd/frostfs-adm/internal/modules/morph/config/config.go +++ b/cmd/frostfs-adm/internal/modules/morph/config/config.go @@ -137,6 +137,8 @@ func SetConfigCmd(cmd *cobra.Command, args []string) error { return wCtx.AwaitTx() } +const maxECSum = 256 + func validateConfig(args map[string]any, forceFlag bool) error { var sumEC int64 _, okData := args[netmap.MaxECDataCountConfig] @@ -172,9 +174,9 @@ func validateConfig(args map[string]any, forceFlag bool) error { } } - if sumEC > 256 && !forceFlag { - return fmt.Errorf("the sum of %s and %s must be <= 256, got %d", - netmap.MaxECDataCountConfig, netmap.MaxECParityCountConfig, sumEC) + if sumEC > maxECSum && !forceFlag { + return fmt.Errorf("the sum of %s and %s must be <= %d, got %d", + netmap.MaxECDataCountConfig, netmap.MaxECParityCountConfig, maxECSum, sumEC) } return nil }