writeFileToZip adds a file to the zip archive, from a file, and retains the mtime
(zw *zip.Writer, filename string, fromFile string)
| 495 | |
| 496 | // writeFileToZip adds a file to the zip archive, from a file, and retains the mtime |
| 497 | func (cli *cliSupport) writeFileToZip(zw *zip.Writer, filename string, fromFile string) { |
| 498 | mtime := time.Now() |
| 499 | |
| 500 | fi, err := os.Stat(fromFile) |
| 501 | if err == nil { |
| 502 | mtime = fi.ModTime() |
| 503 | } |
| 504 | |
| 505 | fin, err := os.Open(fromFile) |
| 506 | if err != nil { |
| 507 | log.Errorf("could not open file %s: %s", fromFile, err) |
| 508 | return |
| 509 | } |
| 510 | defer fin.Close() |
| 511 | |
| 512 | cli.writeToZip(zw, filename, mtime, fin) |
| 513 | } |
| 514 | |
| 515 | func (cli *cliSupport) dump(ctx context.Context, outFile string, fast bool) error { |
| 516 | var skipCAPI, skipLAPI, skipAgent bool |
no test coverage detected