diff options
Diffstat (limited to 'models/repo_list.go')
-rw-r--r-- | models/repo_list.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/models/repo_list.go b/models/repo_list.go index 2c6be0a576..35b2ab5bf8 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -42,6 +42,15 @@ func (repos RepositoryList) Swap(i, j int) { repos[i], repos[j] = repos[j], repos[i] } +// FIXME: Remove in favor of maps.values when MIN_GO_VERSION >= 1.18 +func valuesRepository(m map[int64]*repo_model.Repository) []*repo_model.Repository { + values := make([]*repo_model.Repository, 0, len(m)) + for _, v := range m { + values = append(values, v) + } + return values +} + // RepositoryListOfMap make list from values of map func RepositoryListOfMap(repoMap map[int64]*repo_model.Repository) RepositoryList { return RepositoryList(valuesRepository(repoMap)) |