code: func (t *stiTar) writeTarHeader(tarWriter Writer, dir string, path string, info os.FileInfo, includeDirInPath bool, logger io.Writer) error {
  	var (
  		link string
  		err  error
  	)
  	if info.Mode()&os.ModeSymlink != 0 {
  		link, err = os.Readlink(path)
  		if err != nil {
  			return err
  		}
  	}
  	header, err := tar.FileInfoHeader(info, link)
  	if err != nil {
  		return err
  	}
  	// on Windows, tar.FileInfoHeader incorrectly interprets directory symlinks
  	// as directories.  https://github.com/golang/go/issues/17541
  	if info.Mode()&os.ModeSymlink != 0 && info.Mode()&os.ModeDir != 0 {
  		header.Typeflag = tar.TypeSymlink
  		header.Mode &^= 040000 // c_ISDIR
  		header.Mode |= 0120000 // c_ISLNK
  		header.Linkname = link
  	}
  	prefix := dir
  	if includeDirInPath {
  		prefix = filepath.Dir(prefix)
  	}
  	fileName := path
  	if prefix != "." {
  		fileName = path[1+len(prefix):]
  	}
  	header.Name = filepath.ToSlash(fileName)
  	header.Linkname = filepath.ToSlash(header.Linkname)
  	// Force the header format to PAX to support UTF-8 filenames
  	// and use the same format throughout the entire tar file.
  	header.Format = tar.FormatPAX
  	logFile(logger, header.Name)
  	glog.V(5).Infof("Adding to tar: %s as %s", path, header.Name)
  	return tarWriter.WriteHeader(header)
  }
docs: // writeTarHeader writes tar header for given file, returns error if operation fails