Skip to content

Commit

Permalink
fix: make processedFields a set (#1389)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Melanchyk <[email protected]>
  • Loading branch information
arturmelanchyk authored Jan 7, 2025
1 parent c7e9710 commit cc64b05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit cc64b05

Please sign in to comment.