Updated Edit
On this page
Shared fixture helpers for the test suite: building directory trees from path-to-content maps and applying permission modes with restoring cleanup hooks.
#internal/testutil
#internal/testutil
Package testutil provides shared helpers for building fixture trees.
#WriteTree
func WriteTree(t *testing.T, root string, files map[string]string)WriteTree creates files under root from a map of slash-separated relative paths to contents. Keys ending in "/" create (possibly empty) directories. Parent directories are created as needed.
#Chmod
func Chmod(t *testing.T, root, rel string, mode os.FileMode)Chmod applies a mode to a path under root, registering cleanup to restore permissions so t.TempDir removal succeeds.