fix(embed): use go-rice for large backend assets

Golang embed FS has a hard limit that we might exceed when providing
many binary alternatives.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2025-05-03 11:16:00 +02:00
parent 72111c597d
commit 8d0419d3d1
12 changed files with 90 additions and 53 deletions

View file

@ -1,19 +1,19 @@
package assets
import (
"embed"
"io/fs"
"os"
rice "github.com/GeertJohan/go.rice"
"github.com/rs/zerolog/log"
)
func ListFiles(content embed.FS) (files []string) {
err := fs.WalkDir(content, ".", func(path string, d fs.DirEntry, err error) error {
func ListFiles(content *rice.Box) (files []string) {
err := content.Walk("", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if d.IsDir() {
if info.IsDir() {
return nil
}
@ -21,7 +21,7 @@ func ListFiles(content embed.FS) (files []string) {
return nil
})
if err != nil {
log.Error().Err(err).Msg("error walking the embedded filesystem")
log.Error().Err(err).Msg("error walking the rice box")
}
return
}