Merge pull request #8595 from cardyok/scratch_generator_use_dst

snapshots/blockfile: use passed in dst in scratchGenerator
This commit is contained in:
Derek McGowan 2023-05-30 08:32:27 -07:00 committed by GitHub
commit 8e90799d1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,8 +55,7 @@ func WithScratchFile(src string) Opt {
return func(root string, config *SnapshotterConfig) {
config.scratchGenerator = func(dst string) error {
// Copy src to dst
scratch := filepath.Join(root, "scratch")
if err := fs.CopyFile(scratch, src); err != nil {
if err := fs.CopyFile(dst, src); err != nil {
return fmt.Errorf("failed to copy scratch: %w", err)
}
return nil