LocalAI/pkg/assets/list.go
Dave 2cd4936c99
fix: security scanner warning noise: error handlers part 1 (#2141)
first group of error handlers to reduce security scanner warning noise level

Signed-off-by: Dave Lee <dave@gray101.com>
2024-04-26 10:34:31 +02:00

28 lines
431 B
Go

package assets
import (
"embed"
"io/fs"
"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 {
if err != nil {
return err
}
if d.IsDir() {
return nil
}
files = append(files, path)
return nil
})
if err != nil {
log.Error().Err(err).Msg("error walking the embedded filesystem")
}
return
}