code: func (u *Untar) recursivelyCreateDir(dir string) error {
  	// process the uid/gid ownership
  	uid := u.MappedUserID
  	gid := u.MappedGroupID
  	if u.PreserveOwners {
  		var err error
  		if uid, err = u.OwnerMappingFunc(uid); err != nil {
  			return fmt.Errorf("failed to map UID for file: %v", err)
  		}
  		if gid, err = u.GroupMappingFunc(gid); err != nil {
  			return fmt.Errorf("failed to map GID for file: %v", err)
  		}
  	}
  
  	abs := filepath.IsAbs(dir)
  	parts := strings.Split(dir, string(os.PathSeparator))
  	if abs {
  		parts = parts[1:]
  	}
  
  	for i := range parts {
  		p := filepath.Join(parts[:i+1]...)
  		if abs {
  			p = string(os.PathSeparator) + p
  		}
  
  		if err := os.Mkdir(p, os.FileMode(0755)); err != nil {
  			if os.IsExist(err) {
  				continue
  			}
  			return err
  		}
  		// We don't error check on chown incase the process is
  		// unprivledged. Additionally, only chown when we actually created it.
  		os.Chown(p, uid, gid)
  	}
  	return nil
  }
docs: // recursivelyCreateDir is used to recursively create multiple elements of a
  // path individually to ensure the uid/gid mapping functions get applied and
  // they have the proper owners.