package main import ( "embed" "io/fs" "log" )
//go:embed somefile.txt var FS embed.FS func main() { err := fs.WalkDir( FS, "", func(path string, d fs.DirEntry, err error) error { log.Println("path: ", path) return nil }, ) if err != nil { log.Println("err: ", err) } } This will output a single empty long line: 2021/06/20 22:32:29 path: d comes set to nil, which seems to be a valid condition according to the docs: *First, if the initial fs.Stat on the root directory fails, WalkDir calls the function with path set to root, d set to nil, and err set to the error from fs.Stat.* This seems like an undesirable outcome to be unable to walk the embed.FS, but I figure maybe it doesn't do so to only allow absolute paths for speed? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1b00707c-9f4e-45de-87a8-0cbdda1e2fd4n%40googlegroups.com.