The code below creates the non-existing directory "nonexistingdir" for MemMapFs but returns an error for OsFs. Shouldn't the behavior be the same?
package main
import (
"github.com/spf13/afero"
"log"
)
func main() {
memFs := afero.NewMemMapFs()
err := afero.WriteFile(memFs, "/tmp/nonexistingdir/testfile.txt", []byte("content"), 0777)
if err != nil {
log.Printf("write MemMapFs file: %v", err)
}
osFs := afero.NewOsFs()
err = afero.WriteFile(osFs, "/tmp/nonexistingdir/testfile.txt", []byte("content"), 0777)
if err != nil {
log.Printf("write OsFs file: %v", err)
}
}
Output from go run:
write OsFs file: open /tmp/nonexistingdir/testfile.txt: no such file or directory
The code below creates the non-existing directory "nonexistingdir" for MemMapFs but returns an error for OsFs. Shouldn't the behavior be the same?
Output from go run:
write OsFs file: open /tmp/nonexistingdir/testfile.txt: no such file or directory