From cc64b051def5562f46353f61c1e08005ead27c3d Mon Sep 17 00:00:00 2001 From: Artur Melanchyk Date: Tue, 7 Jan 2025 12:07:28 +0100 Subject: [PATCH] fix: make processedFields a set (#1389) Signed-off-by: Artur Melanchyk --- config/validator.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/validator.go b/config/validator.go index b88205086..5a309fb58 100644 --- a/config/validator.go +++ b/config/validator.go @@ -36,15 +36,15 @@ func validateConfig(config *Config) error { return fmt.Errorf("unexpected validation error type: %v", err) } - processedFields := make(map[string]bool) + processedFields := make(map[string]struct{}) for _, validationErr := range validationErrors { fieldName := strings.TrimPrefix(validationErr.Namespace(), "Config.") - if processedFields[fieldName] { + if _, ok := processedFields[fieldName]; ok { continue } - processedFields[fieldName] = true + processedFields[fieldName] = struct{}{} log.Printf("Field %s failed validation: %s", fieldName, validationErr.Tag())