I am trying to use fstest.MapFS to help with testing, but I noticed the mapfs implementation of ReadDir <https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/testing/fstest/mapfs.go;l=224-238;bpv=1;bpt=0> does not set the name field which is quite problematic as I rely on that in my code.
*Example Test Code:* t.Run("some test", func(t *testing.T) { fs := fstest.MapFS{ "/some/long/test/path_hi_there": {Mode: fs.ModeDir}, } err := VerifyDir(fs, "/some/long/test/path_hi_there") if err != nil { fmt.Println("unexpected error %+v", err) } }) *Snippet of Code:* func VerifyDir(fsys fs.FS, dir string) error { entries, err := fs.ReadDir(fsys, ".") if err != nil { return err } for _, entry := range entries { if !entry.IsDir() { continue } fmt.Println("expected entry.Name() to not be empty:", entry.Name()) path := filepath.Join(dir, entry.Name()) // do stuff with path... } return nil } Any ideas around this? Any practical examples of using fstest.MapFS to learn from? -- 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/525306e4-0491-4682-bbd5-dcae68bb5429n%40googlegroups.com.