Go does not provide a built-in function to convert between structs; you must manually map fields or use reflection. For most cases, create a new struct and assign values from the source struct to the destination struct fields directly.
func ConvertTarToZip(src tar.Header) zip.FileHeader {
return zip.FileHeader{
Name: src.Name,
Modified: src.ModTime,
Mode: fs.FileMode(src.Mode),
UncompressedSize64: uint64(src.Size),
}
}