code: func packFile(srcFile string, recPath string, tw *tar.Writer, fi os.FileInfo) (err error) {
  	if fi.IsDir() {
  		h, err := tar.FileInfoHeader(fi, "")
  		if err != nil {
  			return err
  		}
  		h.Name = recPath + "/"
  
  		if err = tw.WriteHeader(h); err != nil {
  			return err
  		}
  	} else {
  		target := ""
  		if fi.Mode()&os.ModeSymlink != 0 {
  			target, err = os.Readlink(srcFile)
  			if err != nil {
  				return err
  			}
  		}
  
  		h, err := tar.FileInfoHeader(fi, target)
  		if err != nil {
  			return err
  		}
  		h.Name = recPath
  
  		if err = tw.WriteHeader(h); err != nil {
  			return err
  		}
  
  		if len(target) == 0 {
  			f, err := os.Open(srcFile)
  			if err != nil {
  				return err
  			}
  			if _, err = io.Copy(tw, f); err != nil {
  				return err
  			}
  		}
  	}
  	return nil
  }
docs: // packFile packs a file or directory to tar.Writer.