func WriteEntry(w *tar.Writer, src string, h *tar.Header) error {
	if err := WriteHeader(w, h); err != nil {
		return fmt.Errorf("write header helper: %s", err)
	}
	switch h.Typeflag {
	case tar.TypeDir, tar.TypeLink, tar.TypeSymlink:
		return nil
	case tar.TypeReg, tar.TypeRegA:
		f, err := os.Open(src)
		if err != nil {
			return fmt.Errorf("open src file %s: %s", src, err)
		}
		defer f.Close()
		if _, err := io.CopyN(w, f, h.Size); err != nil {
			return fmt.Errorf("copy file %s to tar writer: %s", src, err)
		}
		return nil
	default:
		return fmt.Errorf("unsupported type %b", h.Typeflag)
	}
}
WriteEntry write the file from the local filesystem into the tar writer.
This function doesn't handle parent directories.
package tario
import (
	"archive/tar"
	"fmt"
	"io"
	"os"
	"strings"
	"time"
)