From 43710b018ab102f74ecaf2339e29593ae5dd3f55 Mon Sep 17 00:00:00 2001 From: "Julien Tant (aider)" Date: Wed, 12 Feb 2025 12:46:43 -0700 Subject: [PATCH] refactor: Replace map[string]bool with map[string]struct{} for key existence check --- server/public/model/custom_profile_attributes.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/public/model/custom_profile_attributes.go b/server/public/model/custom_profile_attributes.go index ba38f73ebb..1a2a65dfe3 100644 --- a/server/public/model/custom_profile_attributes.go +++ b/server/public/model/custom_profile_attributes.go @@ -66,17 +66,17 @@ func (c CustomProfileAttributesSelectOption) IsValid() error { type CustomProfileAttributesSelectOptions []CustomProfileAttributesSelectOption func (c CustomProfileAttributesSelectOptions) IsValid() error { - seenNames := make(map[string]bool) + seenNames := make(map[string]struct{}) for _, option := range c { if err := option.IsValid(); err != nil { return err } - if seenNames[option.Name] { + if _, exists := seenNames[option.Name]; exists { return errors.New("duplicate option name found") } - seenNames[option.Name] = true + seenNames[option.Name] = struct{}{} } return nil