如何修复Windows上压缩的os.PathSeparator解压缩文件?

I'm zipping files on Windows and when unzip on Linux, using the os default application, it doesn't create the folders along the path but a single file named "indexes\search.invcus\index_meta.json" e.g.:

unzip 2019-05-23_113735_data.zip -d xfolder
Archive:  2019-05-23_113735_data.zip
  inflating: xfolder/indexes\search.invcus\index_meta.json  
  inflating: xfolder/indexes\search.invcus\store  
  inflating: xfolder/indexes\search.items\index_meta.json  
  inflating: xfolder/indexes\search.items\store  
  inflating: xfolder/indexes\search.subjects\index_meta.json  
  inflating: xfolder/indexes\search.subjects\store  
  inflating: xfolder/indexes\search.users\index_meta.json  
  inflating: xfolder/indexes\search.users\store  
  inflating: xfolder/data.db         

I get the correct folders and files only if the zip file is created on Linux and unzipped on Windows using 7zip, etc...

func zipFiles(filename string, files []string) error {

    newZipFile, err := os.Create(filename)
    if err != nil {
        return err
    }
    defer newZipFile.Close()

    zipWriter := zip.NewWriter(newZipFile)
    defer zipWriter.Close()

    // Add files to zip
    for _, file := range files {
        if err = addFileToZip(zipWriter, file); err != nil {
            return err
        }
    }
    return nil
}


func addFileToZip(zipWriter *zip.Writer, filename string) error {
    fileToZip, err := os.Open(filename)
    if err != nil {
        return err
    }
    defer fileToZip.Close()

    // Get the file information
    info, err := fileToZip.Stat()
    if err != nil {
        return err
    }

    header, err := zip.FileInfoHeader(info)
    if err != nil {
        return err
    }

    // Using FileInfoHeader() above only uses the basename of the file. If we want
    // to preserve the folder structure we can overwrite this with the full path.
    header.Name = filename

    // Change to deflate to gain better compression
    // see http://golang.org/pkg/archive/zip/#pkg-constants
    header.Method = zip.Deflate

    writer, err := zipWriter.CreateHeader(header)
    if err != nil {
        return err
    }
    _, err = io.Copy(writer, fileToZip)
    return err
}

I expect:

 indexes (folder)
     search.invcus (folder)
         index_meta.json (file)

Did you check out convert a windows created zip to Linux internal paths issue? Seems like something gone wrong while creating that zip file.

Or alternatively, from those answers:

Use 7z rn to rename the files within the archive so that they have a forward slash. Then when you extract the archive, directories will be created.