summaryrefslogtreecommitdiff
path: root/internal/oi
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-11-01 11:31:40 +0200
committerPaul Buetow <paul@buetow.org>2024-11-01 11:31:40 +0200
commit8e5def8c2e3e4ff347b1f60eb5f6007dae1bbd0a (patch)
tree29c97b7f340811cdb7e9e2d63a8554d66cdbdc17 /internal/oi
parent9581ebeb48c48425f2f8f5160455f26dcdc0c550 (diff)
add the .soon tag, and some refactor
Diffstat (limited to 'internal/oi')
-rw-r--r--internal/oi/oi.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/oi/oi.go b/internal/oi/oi.go
index 2aa4417..b2a0953 100644
--- a/internal/oi/oi.go
+++ b/internal/oi/oi.go
@@ -84,20 +84,20 @@ func ReadDir[T any](dir string, cb func(file os.DirEntry) (T, bool)) ([]T, error
return results, nil
}
-func ReadDirRandom[T any](dir string, cb func(file os.DirEntry) (T, bool)) (T, int, error) {
+func ReadDirRandom[T any](dir string, cb func(file os.DirEntry) (T, bool)) (T, error) {
results, err := ReadDir(dir, cb)
if err != nil {
var zero T
- return zero, 0, err
+ return zero, err
}
if len(results) == 0 {
var zero T
- return zero, 0, ErrNotFound
+ return zero, ErrNotFound
}
rand.Seed(uint64(time.Now().UnixNano()))
- return results[rand.Intn(len(results))], len(results), nil
+ return results[rand.Intn(len(results))], nil
}
func IsRegular(path string) bool {