fix: miss remove temp file in createSnapshot
``` func foo() error { defer func() { if err != nil { ... } }() ... } ``` use defer func to do something when err not nil, if foo() not use named error, `err != nil` can not catch all errors, since when err re-defined in if condition, it is a new variable. Signed-off-by: Ace-Tang <aceapril@126.com>
This commit is contained in:
parent
48bebbb6e0
commit
7faaa64cf9
@ -241,9 +241,8 @@ func (o *snapshotter) Walk(ctx context.Context, fn func(context.Context, snapsho
|
|||||||
return storage.WalkInfo(ctx, fn)
|
return storage.WalkInfo(ctx, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) ([]mount.Mount, error) {
|
func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) (_ []mount.Mount, err error) {
|
||||||
var (
|
var (
|
||||||
err error
|
|
||||||
path, td string
|
path, td string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ func (o *snapshotter) getCleanupDirectories(ctx context.Context, t storage.Trans
|
|||||||
return cleanup, nil
|
return cleanup, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) ([]mount.Mount, error) {
|
func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) (_ []mount.Mount, err error) {
|
||||||
ctx, t, err := o.ms.TransactionContext(ctx, true)
|
ctx, t, err := o.ms.TransactionContext(ctx, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user