mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 06:52:54 +00:00
Add generic set type (#21408)
This PR adds a generic set type to get rid of maps used as sets. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
e84558b093
commit
0e57ff7eee
41 changed files with 328 additions and 324 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/packages"
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
conan_module "code.gitea.io/gitea/modules/packages/conan"
|
||||
|
||||
"xorm.io/builder"
|
||||
|
@ -88,7 +89,7 @@ func SearchRecipes(ctx context.Context, opts *RecipeSearchOptions) ([]string, er
|
|||
return nil, err
|
||||
}
|
||||
|
||||
unique := make(map[string]bool)
|
||||
unique := make(container.Set[string])
|
||||
for _, info := range results {
|
||||
recipe := fmt.Sprintf("%s/%s", info.Name, info.Version)
|
||||
|
||||
|
@ -111,7 +112,7 @@ func SearchRecipes(ctx context.Context, opts *RecipeSearchOptions) ([]string, er
|
|||
}
|
||||
}
|
||||
|
||||
unique[recipe] = true
|
||||
unique.Add(recipe)
|
||||
}
|
||||
|
||||
recipes := make([]string, 0, len(unique))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue