dump flag --target should be allowed to write existing file

Signed-off-by: lou <alex1988@outlook.com>
This commit is contained in:
lou 2024-02-08 14:11:57 +08:00 committed by Michael Eischer
parent 6a2b10e2a8
commit 80db02fc35
1 changed files with 1 additions and 1 deletions

View File

@ -174,7 +174,7 @@ func runDump(ctx context.Context, opts DumpOptions, gopts GlobalOptions, args []
canWriteArchiveFunc := checkStdoutArchive
if opts.Target != "" {
file, err := os.OpenFile(opts.Target, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0o666)
file, err := os.Create(opts.Target)
if err != nil {
return fmt.Errorf("cannot dump to file: %w", err)
}