Add comments and fix common lint issues

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-10-20 11:46:19 -04:00
parent 9bd1dc78cb
commit 5fd0415985
15 changed files with 60 additions and 38 deletions

View File

@@ -107,8 +107,8 @@ func (b *snapshotter) Stat(ctx context.Context, key string) (snapshot.Info, erro
return info, nil
}
func (o *snapshotter) Update(ctx context.Context, info snapshot.Info, fieldpaths ...string) (snapshot.Info, error) {
ctx, t, err := o.ms.TransactionContext(ctx, true)
func (b *snapshotter) Update(ctx context.Context, info snapshot.Info, fieldpaths ...string) (snapshot.Info, error) {
ctx, t, err := b.ms.TransactionContext(ctx, true)
if err != nil {
return snapshot.Info{}, err
}

View File

@@ -46,12 +46,10 @@ func boltSnapshotter(t *testing.T) func(context.Context, string) (snapshot.Snaps
return nil, nil, errors.Wrap(err, "failed to create new snapshotter")
}
return snapshotter, func() (err error) {
merr := mount.UnmountAll(root, unix.MNT_DETACH)
if err = cleanupDevice(); err != nil {
return errors.Wrap(err, "device cleanup failed")
} else {
err = merr
return snapshotter, func() error {
err := mount.UnmountAll(root, unix.MNT_DETACH)
if cerr := cleanupDevice(); cerr != nil {
err = errors.Wrap(cerr, "device cleanup failed")
}
return err
}, nil