diff options
Diffstat (limited to 'models/unit')
-rw-r--r-- | models/unit/unit.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models/unit/unit.go b/models/unit/unit.go index 5f5e20de1e..ca3e7f999d 100644 --- a/models/unit/unit.go +++ b/models/unit/unit.go @@ -9,6 +9,7 @@ import ( "strings" "code.gitea.io/gitea/models/perm" + "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" ) @@ -318,14 +319,13 @@ var ( // FindUnitTypes give the unit key names and return valid unique units and invalid keys func FindUnitTypes(nameKeys ...string) (res []Type, invalidKeys []string) { - m := map[Type]struct{}{} + m := make(container.Set[Type]) for _, key := range nameKeys { t := TypeFromKey(key) if t == TypeInvalid { invalidKeys = append(invalidKeys, key) - } else if _, ok := m[t]; !ok { + } else if m.Add(t) { res = append(res, t) - m[t] = struct{}{} } } return res, invalidKeys |