mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 08:20:13 +00:00
chore: teach set
module about iter.Seq
(#6676)
- Add a new `Seq` function to the `Set` type, this returns an iterator over the values. - Convert some users of the `Values` method to allow for more optimal code. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6676 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
46e60ce966
commit
443f7d59f9
9 changed files with 38 additions and 28 deletions
|
@ -11,7 +11,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
|
@ -143,8 +143,7 @@ func (l *LayeredFS) ListFiles(name string, fileMode ...bool) ([]string, error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
files := fileSet.Values()
|
||||
sort.Strings(files)
|
||||
files := slices.Sorted(fileSet.Seq())
|
||||
return files, nil
|
||||
}
|
||||
|
||||
|
@ -184,8 +183,7 @@ func listAllFiles(layers []*Layer, name string, fileMode ...bool) ([]string, err
|
|||
if err := list(name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
files := fileSet.Values()
|
||||
sort.Strings(files)
|
||||
files := slices.Sorted(fileSet.Seq())
|
||||
return files, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue