code: func (f *BasicFilesystem) mkdirAll(path string, perm os.FileMode) error {
  	// Fast path: if we can tell whether path is a directory or file, stop with success or error.
  	dir, err := os.Stat(path)
  	if err == nil {
  		if dir.IsDir() {
  			return nil
  		}
  		return &os.PathError{
  			Op:   "mkdir",
  			Path: path,
  			Err:  syscall.ENOTDIR,
  		}
  	}
  
  	// Slow path: make sure parent exists and then call Mkdir for path.
  	i := len(path)
  	for i > 0 && IsPathSeparator(path[i-1]) { // Skip trailing path separator.
  		i--
  	}
  
  	j := i
  	for j > 0 && !IsPathSeparator(path[j-1]) { // Scan backward over element.
  		j--
  	}
  
  	if j > 1 {
  		// Create parent
  		parent := path[0 : j-1]
  		if parent != filepath.VolumeName(parent) {
  			err = f.mkdirAll(parent, perm)
  			if err != nil {
  				return err
  			}
  		}
  	}
  
  	// Parent now exists; invoke Mkdir and use its result.
  	err = os.Mkdir(path, perm)
  	if err != nil {
  		// Handle arguments like "foo/." by
  		// double-checking that directory doesn't exist.
  		dir, err1 := os.Lstat(path)
  		if err1 == nil && dir.IsDir() {
  			return nil
  		}
  		return err
  	}
  	return nil
  }
docs: // Required due to https://github.com/golang/go/issues/10900