Simply use io/fs fs.WalkDir to get all filenames inside an Golang embedded filesystem.

Full example:

Go:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"embed"
	"fmt"
	"io/fs"
)

//go:embed static
var static embed.FS

func main() {
	fLst, err := getAllFilenames(&static)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	for _, v := range fLst {
		fmt.Println(v)
	}
}

func getAllFilenames(efs *embed.FS) (files []string, err error) {
	if err := fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
		if d.IsDir() {
			return nil
		}

		files = append(files, path)

		return nil
	}); err != nil {
		return nil, err
	}

	return files, nil
}